System Daemon Manager
The System Daemon Manager (SDM) is a tool for running any program as a daemon (background process without controlling terminal) on a Unix system.
- Each daemon is given a name by the user. SDM will watch the daemon, and will allow you to stop the daemon (or check whether the daemon is still running) from any terminal by name.
- SDM uses lock files to determine whether a daemon is running, so this avoids problems with stale pid files. The disadvantage is that the lock files may not reside on an NFS filesystem (since NFS doesn’t support lock files).
- Finally, SDM can be run as any user, not just root. Of course, with SDM you can only stop daemons that are started by you. SDM itself doesn’t need root privileges.
Usage
An example will say probably more than words. In the following demonstration, we start gedit as a daemon:
[bash@localhost]$ sdm start my-fancy-gedit-daemon gedit ~/cool-file.txt
The second argument is the name for this daemon, and the other arguments are the program to start. gedit will now run as a daemon, so even if we close the terminal window (thereby sending a SIGHUP to all processes in the terminal), gedit will keep running.
We can check gedit’s status at any time:
[bash@localhost]$ sdm status my-fancy-gedit-daemon PID: 14235
If we close gedit manually, and we run the ‘status’ command again, then SDM will tell us that that daemon is not running:
[bash@localhost]$ sdm status my-fancy-gedit-daemon Not running.
Finally, if the gedit daemon is running, then we can stop it with the following command:
[bash@localhost]$ sdm stop my-fancy-gedit-daemon
Download
You can get SDM through its Subversion repository:
svn checkout http://public.railsplugins.net/repos/sdm/trunk
Once you’ve checked out the source, you can install it with this command:
make install
SDM requires Perl 5.8 and the Time::HiRes module.

赖洪礼的 blog » Status report said,
July 20, 2007 @ 1:25 pm
[...] System Daemon Manager [...]