This question already has an answer here:

I installed these applications on my Ubuntu:

  • nginx

  • php5-fpm

  • mysql server

  • redis

  • ...

These applications run every time the computer turns on.

How can I prevent these applications from running on start up?
So, these applications only run if I do "service nginx start".

share|improve this question

marked as duplicate by muru, user unknown, Ravan, Pilot6, David Foerster Nov 17 '15 at 20:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
for s in "nginx mysql redis"; do sudo update-rc.d $s disable; done – timkofu Jul 28 '16 at 7:20

If you are not using systemd (Ubuntu 14.10 and earlier), then the short answer is:

update-rc.d -f <service> remove

The following command will give you a list of all services on your machine:

service --status-all

You should be able to find the names of the services you want to disable in there.

For more details, see enabling-and-disabling-services and for the very long answer see this post (as already mentioned by @muru).

For Ubuntu versions that use systemd (15.04 and later) use:

systemctl disable <service>

For more details, see this post on Digital Ocean and the man page for systemctl.

share|improve this answer
    
Starting with Ubuntu 15, this is no longer valid. systemctl disable SERVICE works (see the linked question in answer) – Ryre Apr 28 '17 at 3:27
    
@Ryre Updated my answer - thanks – NZD May 14 '17 at 19:27
    
The link in "For more details see ..." does not mention systemctl. I guess that was for old versions, but now it's confusing. – matteo Jun 23 '17 at 19:54
    
@matteo Up dated my answer with links to posts with more info on systemctl – NZD Jun 24 '17 at 4:57

Another method is by installing rcconf apt-get install rcconf. From rcconf you can enable/disable any service that is installed on your ubuntu/debian server.

share|improve this answer
    
Except of course that it uses functionality of update-rc.d that was removed a few years ago (Debian bug #727735) and it doesn't work with systemd or upstart, i.e. either of the default init systems for Ubuntu Linux for the past decade. – JdeBP Nov 17 '15 at 9:14

Install sysv-rc-conf

apt-get install sysv-rc-conf

Then simply to list services

sysv-rc-conf --list

To disable any services i.e nginx

sysv-rc-conf nginx off

For more information see man sysv-rc-conf

share|improve this answer
2  
Except of course that it doesn't work with systemd or upstart. It is patently (it even being in the package name) only for the old System 5 rc system, which hasn't been the default on Ubuntu Linux for almost a decade. Debian Bug #791689 acknowledges this and questions why it hasn't been marked as conflicting with systemd. – JdeBP Nov 17 '15 at 9:26

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