8

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

2 Answers 2

11

See the man page for update-rc.d.

To stop a service from running at boot:

update-rc.d -f servicename remove

Or:

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
7
  • 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, 2013 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. Jan 4, 2013 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, 2013 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. Jan 4, 2013 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. :) Jan 4, 2013 at 20:15
2

On Debian Squeeze and up:

sudo update-rc.d server-name disable

To reverse:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .