March 24, 2010

How To Remove Automatically Started Programs in Ubuntu 9.10 Karmic Koala

I while ago I blogged about how to setup Apache mod_proxy as a reverse proxy and I installed Tomcat and Apache Web Server with Synaptic Package Manager. The Synaptic Package Manager worked flawless  as usual, but it left me with one problem. The Tomcat Server did start automatically every time I booted Ubuntu, this is typically not wanted on a developer laptop, since you probably also are using some other Java Container that is default using port 8080.

Before we dive into how to remove the auto start in Ubuntu, lets first see how things are configured to be automatically started. As you know the start scripts are located in the

$ /etc/init.d


And to make programs autostart then there are soft links in the

$ /etc/rcX.d


There are several /etc/rc catalogs, and here follows the extract from one of mine catalog.

$ ls -al /etc/rc0.d/
lrwxrwxrwx   1 root root    17 2010-02-19 07:34 K09apache2 -> ../init.d/apache2


So one obvious option would be to directly delete all the soft links in these catalogs, but this is error prone and not recommended, but also it exists a tool to do exactly this – update-rc.d.

$ sudo update-rc.d -f tomcat6 remove 
 Removing any system startup links for /etc/init.d/tomcat6 ... 
   /etc/rc0.d/K08tomcat6 
   /etc/rc1.d/K08tomcat6 
   /etc/rc2.d/S92tomcat6 
   /etc/rc3.d/S92tomcat6 
   /etc/rc4.d/S92tomcat6 
   /etc/rc5.d/S92tomcat6 
   /etc/rc6.d/K08tomcat6


Now is Tomcat no longer automatically started when booting Ubuntu.