daemonitor is a tool for daemonising and monitoring a process. It is intended to
be used as part of a service activation system such as OpenRC.
System V init is typically run as process PID 1 on the system. It has a list of processes to
maintain (/etc/inittab) and is responsible for reaping unclaimed zombies. However,
it's inflexible and complicated (runlevels, restart timing semantics, etc.). Most Linux
distributions use another system on top of this to implement services, which can be switched
on and off at will. OpenRC is one such system.
The problem with this approach is that this system is really just some nice wrappers around starting and stopping daemon processes — there is no actual monitoring of running daemon processes, so if they crash or are otherwise killed unexpectedly (out of memory, out of disk space, ...), the user has to notice this and take specific action to rectify it (assuming it wasn't the SSH server on a remote system that died!).
daemonitor is a small tool for ameliorating this problem. Rather than directly
starting a daemon, RC scripts instead start an instance of daemonitor, which in turn
spawns a child process and runs it. It performs a wait(2) on the child, and restarts
it when it exits. Thus, if the child crashes or is killed for using too much memory, it will be
restarted automatically.
There is one limitation with this approach: daemonitor cannot monitor processes which actually daemonise. The process must remain in the foreground, as a child of the daemonitor process. Most daemons have an option which inhibits their usual daemonising behaviour.
You can download the latest version by cloning the git repository:
git clone git://git.lwithers.me.uk/daemonitor
| Version | Date | Source | GPG Signature (key) | Dependencies |
|---|---|---|---|---|
| 1.0.2 | 2009-04-06 | .tar.bz2 | .tar.bz2 |
Older releases may be found here.