Turning a Ruby Shell Script into a daemon with Eventmachine

First things first: If you are not using Eventmachine already in your Ruby script, you can always use Daemons gem which can make your life much easier. This article can be useful to those who are using Eventmachine in their code for some other reason (like listening to Faye websockets updates for example) and want to turn that into a Linux daemon.

Here is a code sample on how we did it for our new CloudQuartz Linux Agent: start and stop methods can be called using command line parameters with the same names.

Try Cloud 66 for Free, No credit card required