Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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


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


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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
Works a treat, thanks. My only concern with editing /etc/init.d/tomcat7 is whether or not a future apt-get upgrade will overwrite it? For anyone else with this problem, note that I needed to update-rc.d remove/add as above, and the relevant line looks like this: Required-Start: $local_fs $remote_fs $network mysql – fazy Apr 9 '13 at 8:07
As per Debian policy, no update should ever edit/remove/replace a user modified configuration file, you should be offered the choice to review the differences, apply the upstream changes or keep yours untouched. – dawud Apr 9 '13 at 8:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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