0

In Debian 6 and greater using the LSB init style I have added new servers to run on boot using update-rc, and indeed they do appear in the /etc/rc2.d (2 being my run level), and they even start on boot (yay). My question is, looking int the /etc/rc2.d directory, or by other means, how can I determine their run order so I can check I have all the dependencies correct?

Thanks.

othane
  • 101
  • 1

1 Answers1

0

1) In the rc*.d folder, all the symlinks are executed according to the number in the symlink name.

For example:

S16openvpn
S19postgresql
...
S23ntp
...

Here S16 will be executed first, than S19, and so on. Please also take in the account that during boot-up all services from the previous runlevel (/etc/rc2.d) are already started (usually runlevels are started consequently during boot-up).

2) Each LSB script has a header describing runlevel and dependencies.

In this case, the 'SXXyyy' in the rc*.d folder is a symlink to the script in the /etc/init.d folder. If you display the script contents, you can immediately see the LSB header with all details about dependencies and runlevels. Something like the following:

### BEGIN INIT INFO
# Provides:          pulseaudio esound
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      udev NetworkManager
# Should-Stop:       udev NetworkManager
# Default-Start:     2 3 4 5
# Default-Stop:      1
# Short-Description: Start the PulseAudio sound server
# Description:       System mode startup script for
#                    the PulseAudio sound server.
### END INIT INFO

Each time you run update-rc.d, it checks LSB-headers in all the scripts (from /etc/init.d) and places S and K symlinks to the needed rc*.d folders, according to Default-Start and Default-Stop lines of the header.

Please also see:

https://wiki.debian.org/LSBInitScripts

https://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_sysv_style_init

https://superuser.com/questions/308735/why-do-scripts-beginning-with-an-s-exist-in-etc-rc-d-rc0-6-d

https://unix.stackexchange.com/questions/82379/when-running-to-a-run-level-does-it-execute-previous-run-levels

Andrey Sapegin
  • 1,191
  • 2
  • 11
  • 27
  • Yes this is what I though, but I am finding that perhaps the numbers are not the true order when I look at the dmesg output. Also if it was as simple as the numbers ordering the scripts why do I get jumps in the list, ie mine goes "S01bootlogs S01mount_cs S13portmap S15ifplugd S15rsyslog ..." etc, why jump from 01 to 13 ?? .. I read somewhere (I have lost the link now) that the lsb init system can do parallel tasks, could that be it? – othane Feb 16 '15 at 20:41
  • The info about parallel booting can be found in "man startpar" ... that lead me to "man /etc/init.d/.depend.boot", which lead me to http://unix.stackexchange.com/questions/115495/how-to-find-out-in-which-order-etc-init-d-scripts-are-load-on-debian/115498#115498 which more or less answers my question... but still hopefully someone knows a nicer way to lay this out to check the boot more easily (like a sequence diagram) ? – othane Feb 17 '15 at 03:15