How do I stop an init.d server from running on boot, but still allow running it manually?


See the man page for update-rc.d.

To stop a service from running at boot:

update-rc.d -f servicename remove


update-rc.d servicename stop 20 2 3 4 5 .

If you have Debian squeeze or later, or Ubuntu 12.10 or later:

update-rc.d servicename disable

To allow a service to run at boot:

update-rc.d servicename defaults

If you have Debian squeeze or later, or Ubuntu 12.10 or later:

update-rc.d servicename enable

To run the service manually:

service servicename start
service servicename restart

To stop the service manually:

service servicename stop
| improve this answer | |
  • 1
    According to the manpage, -f servicename remove is technically only supposed to be used when you're removing the associated initscript entirely; disable is more correct. – tgies Jan 4 '13 at 2:14
  • 1
    @tgies The disable option may not exist on the target system. It appears to have been introduced in squeeze, and doesn't exist on Ubuntu systems at all. – Michael Hampton Jan 4 '13 at 2:17
  • It definitely exists on at least Ubuntu 12.10; I actually had occasion to use it yesterday. sysv-rc version 2.88dsf-13.10ubuntu13. But I didn't know it was a recently-added thing, so thank you. – tgies Jan 4 '13 at 2:27
  • @MichaelHampton as a note, all versions of Debian older than Squeeze have reached end of life. Lenny is no longer covered by the security team. – Matthew Flaschen Jan 4 '13 at 20:08
  • @MatthewFlaschen I've incorporated those into my answer. Keep in mind that we like answers that will be useful not only today, but hopefully years from now. :) – Michael Hampton Jan 4 '13 at 20:15

On Debian Squeeze and up:

sudo update-rc.d server-name disable

To reverse:

sudo update-rc.d server-name enable
| improve this answer | |
  • These options don't seem to exist? – Michael Hampton Jan 4 '13 at 1:05
  • @MichaelHampton, what distro and version are you on? They exist on Debian Wheezy. – Matthew Flaschen Jan 4 '13 at 2:06
  • Looks like these were introduced with Squeeze. So don't count on them being present on your legacy systems. – Michael Hampton Jan 4 '13 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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