Disable Services

Upstart v/s Init

Older, but still relevant for pre-15 versions: http://askubuntu.com/questions/19320/how-to-enable-or-disable-services

status servicename

If its an upstart job, it will show this:

$ status statd statd start/running, process 942

But if its not, you'll see something more like this:

$ status apache2 status: Unknown job: apache2

For the former:

echo manual | sudo tee /etc/init/SERVICE.override

For the latter:

sudo update-rc.d  crashplan disable

This should produce output like:

 Disabling system startup links for /etc/init.d/crashplan ...
 Removing any system startup links for /etc/init.d/crashplan ...
   /etc/rc2.d/S01crashplan
 Adding system startup for /etc/init.d/crashplan ...
   /etc/rc2.d/K01crashplan -> ../init.d/crashplan

Notice the S to K in the links. You could have just deleted the links, that's only a temporary fix. To quote the manual

A common system administration error is to delete the links with the thought that this will "disable" the service, i.e., that this will prevent the service from being started. However, if all links have been deleted then the next time the package is upgraded, the package’s postinst script will run update-rc.d again and this will reinstall links at their factory default locations. The correct way to disable services is to configure the service as stopped in all runlevels in which it is started by default. In the System V init system this means renaming the service’s symbolic links from S to K.

This of course assumes that your init script conforms to the LSB (linux standards base) and includes a header section.  You have also used (I assume).

insserv -r 

http://manpages.ubuntu.com/manpages/karmic/man8/insserv.8.html



Comments