Startup/shutdown hook for a rails application?

My rails application needs to start an additional tcp server.
Is there any location in a rails app which gets executed
exactly once while ‘booting’ where I should add the execution
of the external server thread ? Same thing for shutdown ?


Friendship is unnecessary, like philosophy and art. It has no
survival value; rather, it is one of those things that give
value to survival. – C.S.Lewis