154

How can I disable autostart for a service without uninstalling? For example, I'd like to leave tomcat installed, but I don't want it turning on every time I restart.

0

4 Answers 4

192

This should do the trick:

Open terminal (Ctrl + Alt + T) and enter the following command:

sudo update-rc.d tomcat disable

Basically update-rc.d will modify existing runlevel links for the script /etc/init.d/tomcat by renaming start links to stop links.

4
  • 6
    Note that the default tomcat service name is "tomcat7" in ubuntu 14.
    – eaykin
    Feb 16, 2015 at 12:45
  • If your tomcat is tomcat6 you will need to do "sudo update-rc.d tomcat6 disable" else you will get error.
    – Dung
    Jun 10, 2016 at 16:11
  • Weirdly, this removed the links, and then created some new ones when I did it for postgresql. Dunno.
    – mlissner
    Mar 30, 2017 at 18:07
  • You might want to consider this message in the update-rc.d: The disable|enable API is not stable and might change in the future. Apr 18, 2017 at 18:34
43

More generic and more visual, with a nice UI: sysv-rc-conf

Uncheck the boxes for tomcat7 (runlevels 2 to 5), quit and that's it.

2
  • cool, that's a tool I haven't seen before. It was useful to confirm that the update-rc.d command actually had worked
    – STW
    Mar 19, 2014 at 1:14
  • This tool is great, it was the thing I was searching for. Thank you very much for it. Apr 24, 2014 at 7:07
41

The disable|enable API is not stable and might change in the future. I suggest you use the following command to remove all the symlinks in /etc/rc?.d/:

update-rc.d -f tomcat remove
1
  • This one worked for me. I had uninstalled tomcat manually yet it was trying to shut it down before any reboot. Disable without -f parameter yelded "file does not exists".
    – ffflabs
    Sep 2, 2013 at 11:54
20

For upstart jobs, you need to disable service like this (e.g. mysql):

$ sudo -s
# echo "manual" > /etc/init/mysql.override
# exit

or using this one-liner:

$ echo "manual" | sudo tee /etc/init/mysql.override > /dev/null
2
  • + 1 million, this is what worked for me. I was trying to stop transmission-daemon from starting on startup and the update-rc.d method used to work, but it looks like its been converted to an Upstart script now so this is the only method that works Mar 7, 2015 at 6:46
  • Thanks, this worked for me and disabling mongodb! Couldn't seem to get it working with echo so I did it the oldschool sudo vi /etc/init/mongodb.override way
    – twig
    Aug 10, 2016 at 0:43

Not the answer you're looking for? Browse other questions tagged .