Ruby Daemon Process to Keep Objects Alive for Transient Ruby Instances

Ruby daemon process to keep objects alive for transient Ruby instances

You're probably looking for something like memcache (Gem) or redis (Gem).

You may also be interested in redis-objects.

So, who should daemonize? The script or the caller?

You probably cannot get a definitive answer, as we generally end up with both: the process has the ability to daemonize itself, and the process monitor has the ability to daemonize its children.

Personally I prefer to have the process monitor or script do it, for a few reasons:

1. if the process monitor wishes to closely follow its children to restart them if they die, it can choose not to daemonize them. A SIGCHLD will be delivered to the monitor when one of its child processes exits. In embedded systems we do this a lot.

2. Typically when daemonizing, you also set the euid and egid. I prefer not to encode into every child process a knowledge of system-level policy like uids to use.

3. It allows re-use of the same application as either a command line tool or a daemon (I freely admit that this rarely happens in practice).



Related Topics



Leave a reply



Submit