Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been working with linux for a while but in a rather simple manner.

I understand that scripts in init.d are executed when the os starts but how exactly does it works?

What if I want to keep a script but don't want it to start automaticly?

Say I have a /etc/init.d/varnish and want to disable it temporary. How do I make sure it doesn't start if the os reboots? I don't want to delete the script. What if I want to add it again?

share|improve this question
up vote 21 down vote accepted

There are a couple ways. If you just want to do this temporarily, you can remove the execute bit from the file:

$ chmod -x /etc/init.d/varnish

Then re-add it when appropriate:

$ chmod +x /etc/init.d/varnish

The "official" way in Ubuntu (as well as in Debian and other Debian derivatives), though, is to use the update-rc.d command:

$ update-rc.d varnish disable

This will remove all of the symlinks from the /etc/rcX.d folders, which take care of starting and stopping the service when appropriate.

See the update-rc.d man page for more information.

share|improve this answer
Thanks for the great response! chmod is an easy solution! I started reading and is helping me understand init. Got me thinking... I should read more of the manual. – iDev247 Jun 28 '12 at 2:36
Glad to help. I should note that the chmod solution should only be used very temporarily. I haven't verified this, but I could see the Upstart system (what Ubuntu uses to start/stop processes automatically) getting confused by this. – EEAA Jun 28 '12 at 3:05
$ sudo update-rc.d -f servicename remove
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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