Shao Zhang <[EMAIL PROTECTED]> writes: > Is there any script out there that will let me to choose what > services to start by default? > > For instance, I would like to have apache installed on my laptop, > but I don't want to start it everytime I boot up. Editing > /etc/init.d/* won't help me much because then I will have to change > it everytime I upgrade the package. > > The ppp's init script uses the file /etc/ppp/ppp-on-boot, to detect > whether to start pppd at boot time, wouldn't it be great if we have > a some kind of similar file, like /etc/default-daemon, which all the > init scripts will check that file to determine whether to start or > not? > > Thanks for any help in advance.
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 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. Gary