[plug] Debian and daemons

Bernard Blackham bernard at blackham.com.au
Sun Oct 5 16:01:25 WST 2003


On Sun, Oct 05, 2003 at 03:52:42PM +0800, Cameron Patrick wrote:
> *But* all the files in /etc/init.d are conffiles so they won't be
> overwritten on an upgrade if you change - so I would tend to stick an
> "exit 0" at the top of /etc/init.d/uml-utilities or whatever it is you
> want to disable.  If you still want to be able to start it manually this
> would be a problem though - perhaps you could kludge around it with
> something like
> 
> 	test -z "${REALLY_START_ME}" && exit 0
> 
> There may well be a better way, however.

Thinking about it, how about:

echo `basename $0` | egrep -q '^[SK][0-9]{2}' && exit 0

So, if it was called from an rc.d script called S33rhubarbs, it
would not execute, but called as /etc/init.d/rhubarbs it would
happily run.

One case I can think of where this wouldn't function correctly is if
the script name ends in .sh and it's called from rcS.d, as this
makes the runlevel system `source` the script, instead of executing
it separately, which could have bad consequences should you try and
exit it. Though as always, I could be wrong :)

Cheers,

Bernard.

-- 
 Bernard Blackham 
 bernard at blackham dot com dot au
_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list