Update: Nicer rc scripts

Stefan Sperling stsp at stsp.name
Wed Apr 11 23:29:12 CEST 2007


Good news everyone,

As discussed on IRC a few days ago, there is still an open
issue with this patch.

Consider the following (ignore the whitespace change, that's
not what I'm on about):

> Index: vendors/Nintendo/common/rc.d/telnetd
> ===================================================================
> --- vendors/Nintendo/common/rc.d/telnetd	(revision 1701)
> +++ vendors/Nintendo/common/rc.d/telnetd	(working copy)
> @@ -8,11 +8,13 @@
>  case "$1" in
>  	start)
>  		echo "Starting $DAEMON"
> -		$DAEMON &
> +		$DAEMON & 
> +		rchelper $?

Note that the daemon is run in the brackground.

This looks a bit racy. I'm not sure what exit code rchelper will
pick up in this case. I have not had time to test this.

Maybe it will always print [ OK ] regardless of whether
the daemon managed to start correctly because it picks up $? from echo?
Or always [ FALSE ]? Or will it only print [ FALSE ] if the $DAEMON binary
is not found, and always [ TRUE ] otherwise?

How do we want to deal with this?

One possibility is having the daemon create a PID file in /var/run/
after succesfull startup (/var/run/$DAEMON.pid). An option could be
added to rchelper that waits a little and then checks for the presence
of that file. This could mean that we'll have to add PID file support
to any daemon that does not support it...

Another possibility is to simply not use rchelper with daemons.

Opinions? Hints? Suggestions?
-- 
stefan
http://stsp.name                                         PGP Key: 0xF59D25F0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://mailman.dslinux.in-berlin.de/pipermail/dslinux-devel-dslinux.in-berlin.de/attachments/20070411/16522f9e/attachment.pgp 


More information about the dslinux-devel mailing list