Debian – Trouble using update-rc.d to change Debian startup order

debianstartup-scripts

I have a Debian Wheezy system on which I want Tomcat to start after MySQL.

In the default runlevel 2, they are named as follows in /etc/rc2.d:

S16tomcat7
S18mysql

I can get the desired effect, at least temporarily, by manually renaming the tomcat7 link:

S18mysql
S20tomcat7

However I want to be able to do this with the update-rc.d command. I believe this will be the best way to make it work for all runlevels, and after package upgrades. I've tried the following:

update-rc.d tomcat7 defaults 20

also

update-rc.d tomcat7 defaults 20 1

as these didn't work, I tried:

update-rc.d tomcat7 remove    
update-rc.d tomcat7 defaults 20

The remove command successfully removed tomcat7, but the above command resulted in it stubbornly returning to S16tomcat7!

Am I doing something wrong?

Best Answer

update-rc.d(8) enables or disables services, while the ordering of services is handled by insserv(8), and can be customized by editing the LSB header of the Tomcat service and setting/adding:


Required-Start: mysql

Further reference can be found here.