Starting service daemons

hinko.kocevar at cetrtapot.si hinko.kocevar at cetrtapot.si
Wed Mar 28 08:20:59 UTC 2007


Denis Vlasenko wrote:
> 
> start-stop-daemon --start -m -p z.pid -x /bin/sleep 100
> 
> Pidfile contains 12422
> 
> and in ps output I see:
> 
> 12422 root     /bin/sleep 100
> 
> You don't see it because you start _self-daemonizing_ applets -
> they fork and then parent exits. Of course start-stop-daemon
> records PID of parent process!

Right. I was lacking that info. Thanks for making it more clear. So 
start-stop-daemon is not meant for daemons? It is supposed to 
'daemonize' applications that don't fork to background themselves?

> 
> Which leads me to a question "why do you need start-stop-daemon
> at all" if you can do the same in shell:

By using start-stop-daemon I tried to overcome most of the headaches 
with service running, not running, how/when to run, how to check the 
service etc. start-stop-daemon offered some neat features like pid 
recording and detection if service is already running - thus not 
starting it again.

> 
> #!/bin/sh
> echo $$ >z.pid; exec /bin/sleep 100
> 
> Simple, huh?

Yes it is. For now I rely on the 'pidof -o %PPID process' to get correct 
PID of the running process and starting/stopping is done without any 
wrappers (eg. start-stop-daemon ).


best regards,
hinko

-- 
ČETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: hinko.kocevar at cetrtapot.si
Http: www.cetrtapot.si




More information about the busybox mailing list