Debian Linux services running at boot

After using Red Hat variants for many years, I’ve found myself addicted to the chkconfig utility and it’s ease of use.  Debian on the other hand, well… heh.  It’s old school, with a twist.

Note: If you are having a problem with NFS mounts not appearing on boot with a Debian system and you’ve tried everything, see if the directory “/var/run/network/mountnfs” exists.  If it exists and your mounts are not showing, try removing it and rebooting.  The script /etc/network/if-up.d runs mountnfs, which checks this directories existence so it doesn’t walk over itself.  If it exists, the assumption is it ran earlier and everything is up.

Anyway, if you’re like me, you want an easy spit-out of what will run, then update what quickly after with update-rc.d.  Well, here’s a script I slapped in (Gotten from Vivek Gite) named chkconfig.sh, and spits out the services running under the given runlevel.  That can be changed by editing/hacking the script, making “R” into whatever runlevel.  Enjoy.  If you wish to remove services after, simply use:

update-rc.d -f {service-name} remove
update-rc.d {service-name} stop 20 2 3 4 5 .

Example:

update-rc.d -f apache2 remove
 update-rc.d apache2 stop 20 2 3 4 5 .

Here’s the chkconfig.sh script:

#!/bin/sh

R=$(runlevel | awk ‘{ print $2}’)
for s in /etc/rc${R}.d/*;
do
basename $s | grep ‘^S’ | sed ‘s/S[0-9].//g’
done

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.