[lsb-discuss] Re: REVIEW: System Initialization
tobias.burnus at physik.fu-berlin.de
Thu Jun 19 05:17:40 PDT 2003
On Wed, 18 Jun 2003, Mark Hatle wrote:
[start_daemon and creating PID files]
> I am assuming start_daemon will background the app automagically.. if
> it isn't supposed to, then I'm at the point of wondering what the
> purpose of start_daemon actually is.
Well, I dont know any real-world daemon which doesn't fork and thus
backgrounds itself. For those programs, writing a start_daemon it is easy:
Start the demaon, check their exit code and you are done.
The main purpose of start_daemon is, in my opinion, that it checks
whether the daemon is already running. (This unfortunally might fail for
PERL programs, depending on the start_daemon implementation.)
> Ok, now assuming start_daemon backgrounds, how do I get the pid(s) from
> start_daemon, to store in the pidfile for a later kill operation.. :)
Well, using Debian's start-stop-daemon you use "--background
--make-pidfile". SuSE's startproc does never create a PID file, but the
LSB requires the daemon to create a PID file: "LSB-complaint applications
who wish to use the pidofproc function in their init scripts must store
the pid in /var/run/basename.pid".
More information about the lsb-discuss