I just moved to debian squeeze and need to change the startup sequence of some scripts. I used to do this with update-rc.d service defaulta xx xx but now with the LSB way of doing things the update-rc.d method does not change the order.

I need to start the packages in this order:

  • openvpn
  • ndo2db
  • nagios
  • apache2

Any ideas?


Just use Required-Start keyword. For e.g, init script for ndo2db should have the following:

# Provides:          ndo2db
# Required-Start:    $openvpn
# Required-Stop:     $openvpn
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Daemonized ndo2db
# Description:       Starts the ndo2db daemon

Take a look at this for more details.

| improve this answer | |
  • What does one invoke to update the rcN.d-symlinks with the new values, though? – Kvisle Oct 21 '11 at 5:05
  • How about dpkg-reconfigure insserv sysv-rc: wiki.debian.org/LSBInitScripts/DependencyBasedBoot – quanta Oct 21 '11 at 5:12
  • What about having apache2 load after openvpn. I'm not sure that changing lsb scrpits for apache2 is a solution. – Ricardo Marimon Oct 21 '11 at 5:29
  • 1
    There's nothing wrong with patching the init-scripts. It's like any other configuration file - you need to pay attention when you upgrade to a newer version, and apt will present you with a diff (because it detects that you've edited the file). The same would apply if you were using upstart, and patching the upstart-configfiles. – Kvisle Oct 21 '11 at 6:16
  • I always thought that patching the init-scripts was a no-no. Particularly in trying to keep maintainability going forward. This is perhaps one of the reasons for having /etc/default/*. Perhaps there is something similar for lsb scripts? – Ricardo Marimon Oct 22 '11 at 0:15

Once you edit the Required-Start lines (and Required-Stop lines) in the appropriate files in your init.d directory, perform the following commands for each of the services you'd like reordered:

chkconfig --del servicename

chkconfig --add servicename

Once you do this, the init scripts will be reordered in your rc#.d directories.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.