How to list services/daemons started at boot _and_ check their loading order

Solution 1:

In short:

ls /etc/rc*.d

This shows you what starts at which runlevel, and within each level the order is determined by the number after the letter (K is Kill, S is start).

You can configure what starts at each runlevel with sysv-rc-conf, which is installable with apt.

e.g. on my system apache2 is symlinked in rc5.d as "S20apache2". A link in the same directory with S19 would start before it, something with S21 would start after it.

Further reading:

  • http://wiki.debian.org/RunLevel
  • http://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_the_meaning_of_the_runlevel

Solution 2:

Would rcconf and sysv-rc-conf utilities help?

# aptitude install rcconf sysv-rc-conf

Afterwards you can run them by typing rcconf or sysv-rc-conf.

rcconf sysv-rc-conf


Solution 3:

You can list all services and their status with this simple command:

service --status-all

From the manual:

service --status-all runs all init scripts, in alphabetical order, with the status command. The status is [ + ] for running services, [ - ] for stopped services and [ ? ] for services without a 'status' command. This option only calls status for sysvinit jobs; upstart jobs can be queried in a similar manner with initctl list.


Solution 4:

for i in `find /etc/rc*.d -name S*`; do basename $i | sed -r 's/^S[0-9]+//'; done | sort | uniq

Sample output:

acpid
anacron
avahi-daemon
boa
bootlogd
bootlogs
bootmisc.sh
checkfs.sh
checkroot-bootclean.sh
checkroot.sh
cryptdisks
cryptdisks-early
dbus
delayed-services
hostname.sh
hwclock.sh
keyboard-setup
killprocs
kmod
lightdm
mountall-bootclean.sh
mountall.sh
mountdevsubfs.sh
mountkernfs.sh
mountnfs-bootclean.sh
mountnfs.sh
mtab.sh
pppd-dns
procps
qemu-kvm
rc.local
rmnologin
rsyslog
single
sleep
stop-bootlogd
stop-bootlogd-single
udev
udev-mtab
x11-common