Debian – How to find out in which order /etc/init.d scripts are load on Debian

debianinitstartupsysvinit

I want to run one sysvinit script before another and figured out how to do that.

To make sure, this actually happens in the the order I like, I would like to see a list, in which order that happens.

I found sudo insserv --showall already, but can't make head or tail of it, since it lists init scripts multiple times.

How to find out in which order /etc/init.d scripts are load on Debian?

Best Answer

There's some files in /etc/init.d/ directory:

$ ls -al /etc/init.d/ | grep -i depend
-rw-r--r--   1 root root  2739 Feb 17 05:20 .depend.boot
-rw-r--r--   1 root root  2221 Feb 17 05:20 .depend.start
-rw-r--r--   1 root root  1855 Feb 17 05:20 .depend.stop

Whenever you run update-rc.d the files will change. .depend.boot file is for S level, .depend.start is for 2 3 4 5 levels and .depend.stop for 0 1 6.

In my case, I have the following order in .depend.start:

TARGETS = killprocs motd nvidia-kernel nfs-common rsyslog privoxy virtualbox
linuxlogo acpi-fakekey binfmt-support fancontrol openvpn hddtemp cgconfig 
dropbox-container dbus dnscrypt-proxy pulseaudio atd cryptmount exim4 
qbittorrent-nox ddclient acpi-support smartmontools ssh ntp loadcpufreq acpid 
cron rsync cgrulesengd cpufrequtils bootlogs bootchart-done single rmnologin 
rc.local stop-bootlogd

You can also see why the order presents in the way you see above. Each next line looks like this:

cgrulesengd: rsyslog cgconfig

which means that cgrulesengd needs rsyslog cgconfig to be started prior.