I need to have only stop scripts in rcN.d (runlevels 0,1,6) for apache2. So that I always start it by myself, but when reboot occurs server will shut down apache2 properly. And when I change runlevel 2-3 server doesnt' touch apache daemon (leaving it in the state it is).

Basically, I just need a legal way to remove apache2 startup symlinks from rc2.d -> rc5.d. With tools like update-rc.d.

I can just remove those symlinks by hands, but I'm not sure if this is a proper way for this.


You can remove symblinks by hands, there is no problem to do that this way if you know what you are doing.

  • 1
    And the next time the service's package is updated update-rc.d is run again and the links are recreated...
    – nem75
    Jan 20 '12 at 14:46

This should do the trick :

update-rc.d apache2 disable

Basically update-rc.d will modify existing runlevel links for the script /etc/init.d/apache2 by renaming start links to stop links.

If you wanted to disable only runlevel 2 and 5, you could do :

update-rc.d apache2 disable 2 5


  • I do not what runlevels 2,3,4,5 to affect apache2 at all. In you case apache2 will be stopped, if it was running.
    – Evgenyt
    Jun 17 '10 at 16:53
  • No it wouldn't be stopped :-) When you reboot your server, you're switching it from runlevel 2 (Debian's default) to runlevel 6 and that's when all the scripts in /etc/rc6.d/ are executed. Since you're already in runlevel 2 when executing the command, nothing will happen to the Apache2 processes. Jun 18 '10 at 12:59
  • But what if i switch to runlevel 3, 4 or 5? It would stop. That is the reason.
    – Evgenyt
    Jun 19 '10 at 10:12

is the new way to do this job.

enter image description here

  • Amazing tool! In official repos & also provides arguments for easy one liners like sysv-rc-conf --display apache2 and sysv-rc-conf apache2 off
    – bksunday
    Aug 7 '16 at 17:28
update-rc.d -f apache2 remove
  • This also removes shutdown scripts, which I want to leave (for reboot/halt).
    – Evgenyt
    Jun 17 '10 at 16:52

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.