Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My problem is that I don't want to stop the apache daemon with the command ./apache2 stop from /etc/init.d (I know to do this). I don't want the apache service start automatically in /etc/init.d on the system startup. But I also need to keep the service in the init.d folder. How can I do this? Do I have to change some fields in the service script ?

share|improve this question
    
Please add your distribution. –  msys Jan 24 '13 at 15:15
    
I have Debian Wheezy. –  Kyrol Jan 25 '13 at 14:18

2 Answers 2

up vote 5 down vote accepted

Depending on your distro, you should be able to execute a command to disable the service on startup. Doing this it will be stopped until you manually start it. Here are some examples on different distros:

  • Ubuntu/Debian: update-rc.d -f apache2 remove
  • Gentoo: rc-update del apache2
  • ArchLinux: systemctl disable apache2
share|improve this answer
    
Thanks a lot. It works. –  Kyrol Jan 26 '13 at 15:18

This is an old thread, but I’ll add what I've just learned to help others who come here.

For Debian, the problem with the answer given is that the change will be undone the next time there's an update to the software. From the man page for update-rc.d:

A common system administration error is to delete the links with the thought that this will "disable" the service, i.e., that this will prevent the service from being started. However, if all links have been deleted then the next time the package is upgraded, the package's postinst script will run update-rc.d again and this will reinstall links at their factory default locations.

I believe that it’s better to use the disable directive:

sudo update-rc.d apache2 disable

This has the advantage that the enable directive can reverse the change.

share|improve this answer
    
+1 very good followup info. –  JakeGould Mar 9 at 5:48
    
+1 for nice answer! –  Kyrol Mar 9 at 11:45

Your Answer

 
discard

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.