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?
Best Answer
There are a couple ways. If you just want to do this temporarily, you can remove the execute bit from the file:
Then re-add it when appropriate:
The "official" way in Ubuntu (as well as in Debian and other Debian derivatives), though, is to use the
update-rc.d
command: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.