How do you run your daemons?

How do you start and daemonize your programs (PSGI apps, fastcgi apps, gearmand, several memcached instances, custom handcoded daemons)?

Do you write custom init scripts?
Use daemontools or upstart?
Do you simply invoke plackup in terminal? :)
Maybe you spawn your fcgi apps directly from your webserver?

Do you need watchdogs? Do you actually write them?

8 Comments

I'm using daemontools for managing servers.

I also write a custom init script (also for Ubuntu :D). I launch a watch dog that will call the init script's status call and send the information back to a Nagios server.

I'm using daemontools for several daemons. Nice that it auto-restarts and has easy start/stop tools.

For FastCGI webapp runners I let the webserver manage their execution.

For most other "daemons", I usually have them running foreground, rather than background, in screen sessions. I find them easier to find and control this way.

I install my daemons in the appropriate /etc/rc run level and let init(8) take care of them.

runit, which is some kind of implementation of daemontools

I actually asked the same question on irc just a couple of days ago, and I ended up using upstart after having battled with init scripts for several years. The more advanced respawning feature of upstart (compared to sysvinit) is really nice.

What is even nicer is that there is almost no boilerplate left in the upstart jobs compared to the old init scripts.

The only thing that was missing on the 0.3.9 version bundled with Ubuntu 8.04 was redirecting output to file/syslog and running jobs as a specific (non-root) user. Both of these issues I worked around by using "su" and "logger". Hopefully I won't have to do this in the future.

Leave a comment

About Vyacheslav Matyukhin

user-pic I blog about Perl.