How do I stop a program running at startup in Linux. I want to remove some apps from startup to allow them to be managed by
supervisord e.g apache2
Depending on your distro use the chkconfig or update-rc.d tool to enable/disable system services.
On a redhat/suse/mandrake style system:
Checkout their man pages for more info.
If you are dealing with a modern Ubuntu system and a few other distros you may have to deal with a combination of traditional init scripts and upstart scripts. Managing init scripts is covered by other answers. The following is one way to stop an upstart service from starting on boot:
The problem with this method is that it does not allow you to start the service using:
An alternative to this is to open the
That is, change this to
where the "..." is whatever was after "start on" previously. This way, when you want to re-enable it, you don't have to remember what the "start on" parameters were.
Finally, if you have a new version of upstart you can simply add the word "manual" to the end of the configuration file. You can do this directly from the shell:
This will cause upstart to ignore any "start on" phrases earlier in the file.
On Ubuntu 10.04 you can control some startup programs from the GUI.
Slackware and Arch linux have similar methods of stopping/starting processes at boot, different than the Ubuntu and Redhat-style examples given above.
In both Slackware and Arch linuxes, sh scripts exist in directory
For example, Slackware starts the Apache web server with a script
To keep some process from starting during system boot, on Slackware, you just make the appropriate script in /etc/rc.d not executable. To keep Apache from starting at the next boot:
To stop an Apache that got started at boot:
Arch is a bit more complex. The file /etc/rc.conf, a shell script, has an array DAEMONS. To keep Apache from starting at boot, you'd change this line in /etc/rc.conf:
To this line:
To stop an already executing apache, you'd execute
On recent Fedora and Future RHEL systems
will disable the httpd service