How do I run a Debian init.d script manually, not at boot?

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


Solution 1:

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

Solution 2:

On Debian Squeeze and up:

sudo update-rc.d server-name disable

To reverse:

sudo update-rc.d server-name enable