ubuntuinit.d

/etc/init.d execution order & how it relates to /etc/rcN.d


After a spot of digging around I have established – I may be wrong since my knowledge of these issues is rather sketchy – that the scripts in /etc/init.d are run in the order determined by the symlinks in /etc/rcN.d.

It is not quite clear to me why I have, on Ubuntu 14.10, a whole sequence of rcN.d folders with N running from 0 to 5. runlevel indicates that the current runlevel is N 2. In /etc/rc2.d I have the files:

S01rsyslog S02memcached ... S03grub-common

I assume this indicates that the S01 scripts will run prior to the S02 scripts etc.

Now here is what I need to do – run my own script in init.d AFTER everything else. Would this be the right thing to do?


Solution

  • I finally found all the information I required regarding runlevels and more here. Hopefully, this will be useful to anyone else who runs into this question. To quote the essential bits explained there

    Simply put, a 'runlevel' determines which programs are executed at system startup. Most of your exposure to run levels will deal with system startup. You will become intimately familiar with the exceptions the first time you have to troubleshoot a failed system.

    Linux run levels are numbered 0 through 6. Run levels stop at six for practical and historical reasons, but it is entirely possible to have more if desired.

    A brief explanation of the various runlevels: