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.

Khash Sajadi

Khash is the founder and CEO of Cloud 66, a full stack container management as a service. Follow him on @khash

London, UK and San Francisco, US
Subscribe and get updates

Have feedback? Please get in touch @cloud66 on Twitter.

Everything you need to build, manage and maintain containers in production on your own servers and any cloud

Try Cloud 66 — 14 Days Free Trial, No credit card required