Geek Lair

Posts Tagged ‘upstart

Ubuntu Lucid: Disable services from starting up during boot time

with one comment

I use MySql only occasionally on my Ubuntu Lucid Lynx (10.04) install. As such, I didn’t want the mysql server starting up automatically during boot process. There must be a better way of disabling a service, but this is what worked for me:

Ubuntu now uses Upstart to startup services during boot time. The config files for the services are in /etc/init and they all have filenames ending in .conf.

The config files have a “start on” section which will have events on which the service should start. Commenting out that section prevents the service from starting automatically.

If you want to disable a service, say mysql, edit its config file – /etc/init/mysql.conf.

Change this:

start on (net-device-up
    and local-filesystems
    and runlevel [2345])
stop on runlevel [016]

to this:

#start on (net-device-up
#    and local-filesystems
#    and runlevel [2345])
stop on runlevel [016]

Reboot.

To see the status of the Upstart jobs run this command:

initctl list

The output should look something like this:

alsa-mixer-save stop/waiting
avahi-daemon start/running, process 1061
mountall-net stop/waiting
nmbd stop/waiting
rc stop/waiting
rsyslog start/running, process 1046
.
.
mysql stop/waiting
.
.

Since the “start on” section was commented out in /etc/init/mysql.conf, the mysql job status will show up as “stop/waiting”

To start the mysql server manually, use the start command:

sudo start mysql

Now if you run the command initctl list, the mysql job will be in running status:

alsa-mixer-save stop/waiting
avahi-daemon start/running, process 1061
mountall-net stop/waiting
nmbd stop/waiting
rc stop/waiting
rsyslog start/running, process 1046
.
.
mysql start/running, process 9462
.
.

To stop the mysql server, use the stop command:

sudo stop mysql

Written by anonir

August 9, 2010 at 23:28

Posted in Linux, Ubuntu

Tagged with , , ,