Run allows you to run a program, and ensure that you have only
one of that program running simultaneously. i.e. we would like to
run some program, but not if its already running. We also may
need to restart the program if it dies. Run accomplishes these
tasks giving all the functionality that would otherwise require
tedious shell scripting to accomplish.
* Watch programs and restart them if they die.
* Get the process id of programs started with `run'.
* Do no more that x restarts per second.
* Programs can be stopped from a separate session; also
returning the programs exit status.
* Fork into the background to run daemon processes.
These utilities properly use shared file locking and Sys V IPC to
achieve their functionality. They are hence efficient and clean
implementations of what is done usually in Unix startup scripts.
It would be really nice if all startup scripts made use of `run'
to start daemon process. It would then be really easy to get pid's
and stop daemons *and* *be* *sure* *that* *they* *are* *stopped*.
See the man page for an example.
Currently a deficiency exists when trying to write simple shell
scripts to monitor processes. There is no simple way of ensuring
that a program has only a single running copy. There is also no
simple way of killing a process by name, and ensuring that it has
died, or establishing if a daemon is alive, or establishing the
process id of a daemon.
The usual way of checking if a process is alive is something like:
ps awx | grep <program> | grep -v grep
This method is cumbersome, CPU intensive, and unreliable.
`run' package cleanly solves all of these problems.