Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to make apache and mysql not run automatically on startup?

Currently, whenever I boot my machine, they start automatically and run in the background.

I am using Ubuntu 12.04.

share|improve this question

3 Answers 3

up vote 23 down vote accepted

Apache

sudo update-rc.d -f apache2 disable

MySQL

sudo nano /etc/init/mysql.conf

Comment out (using a hash sign) the start on section - and this section only! If it spans multiple lines, add a hash sign to each line.

For example:

#start on (net-device-up
          #and local-filesystems
          #and runlevel [2345])
share|improve this answer
    
Do i have to do this on every startup –  shubham May 17 '12 at 16:51
    
Nope, only once.. The changes are persistent. :) –  SirCharlo May 17 '12 at 16:52
5  
A cleanest way to disable autostart for any service with a .conf file in /etc/init (like mysql), is to run as root: echo "manual" >> /etc/init/[service_name].override. –  el.atomo Nov 23 '12 at 10:41
    
kudo @el.atomo Manpage Event Definition "manual" This stanza will disregard any previously seen start on definition. By adding this stanza on any line below the start on definition, it provides the ability to stop a job from being automatically started. When specified, the only way to start such a job is via start. -- Also, take a look at Override File Handling Override files allow a jobs environment to be changed without modifying the jobs configuration file. –  BullfrogBlues Dec 6 '12 at 19:56
    
Also this will work too: sudo mv /etc/init/cups.conf /etc/cups.conf.disabled. It's easier to see what services are disabled when you do this. Re: Can you remove printer support (cups) –  BullfrogBlues Dec 7 '12 at 11:40

For all system services in /etc/init.d, disabling them can be done with the update-rc.d command, e.g.:

update-rc.d -f apache2 remove

To restore it to running on startup:

update-rc.d apache2 defaults

You can also manually start and stop via service apache2 start and service apache2 stop.

share|improve this answer

Run the following in a terminal:

update-rc.d -f apache2 remove

update-rc.d -f mysql remove

see: http://www.aboutlinux.info/2006/04/enabling-and-disabling-services-during_01.html

share|improve this answer
    
Do i have to do this on every startup –  shubham May 17 '12 at 16:46
    
Sorry for my late reply (just saw your message). You don't have to do that every time it boots, it should stick –  MCR Jul 26 '12 at 11:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.