Last Updated: February 25, 2016
·
913
· mavimo

Manage auto-start services

I love experiment with exotic application in my machine but sometime when I install they some service will be add to start in background.. this can be a problem.... overload my machine with different unused service!!!

Ubuntu use Upstart and SystemV to manage services, so we need to know how-to administer they.

To know my machine service status I use:

chkconfig --list | grep \:on

That list all service run configuration staus, maybe you need to install chkconfig using:

sudo apt-get install chkconfig

If you find some active service that you do not use frequently you can choise to disable it and start it manually when do you need it.

First step is to identify if you service is managed by upstart or SystemV; this is really simple. If service file in /etc/init.d is a link this is managed from Upstart otherwise from SystemV, you can individuate it by:

ls -la /etc/init.d/<service_name>

Eg.:

ls -la /etc/init.d/apache2

Upstart

You can disable tha autostart of service in Upstart by a new file in /etc/init with the <service_name> name and extension override, and write inside it manual. This file put this service in manual stanza and you can manually start it.

sudo su -
echo 'manual' > /etc/init/<service_name>.override

Eg. I need to remove MongoDB autorun so, I can write:

sudo su -
echo 'manual' > /etc/init/mongodb.override

System V

If the service is managed by System V you ca disable it using:

sudo update-rc.d -f <service_name> remove

Eg. to disable nginx:

sudo update-rc.d -f nginx remove

Now your service are not automatically started and you can start they using

sudo service <service_name> start

Authored by Marco Vito Moscaritolo