The official ubuntu documentation says the following:
What order are initscripts started and stopped in?
If a service has not been converted to upstart, this has not changed; the symlinks are named SNNname or KNNname, where NN is a number from 00 to 99. The K scripts are run first in numerical order, followed by the S scripts in numerical order.
However, services which have been converted to upstart will define their start criteria in the file, like this:
start on runlevel [2345] stop on runlevel [! 2345]
Runlevel 2, 3, 4, or 5. It should be noted that it will be started in parallel with every other service that starts on those runlevels, and anything else still starting . The [! 2345] in the stop on means it will be stopped whenever runlevel that is not 2, 3, 4, or 5 is reached.
Then I conclude that there is an upstart service that should be calling your /etc/init.d/rc.local
in parallel with other init scripts.
I suggest creating an old-fashioned init script ( sysvinit
) in /etc/rcX.d/S99script
, where X is your default runlevel (check yours in /etc/init/rc-sysinit.conf
, this should ensure that it will run last.