I tried using this sudo /etc/init.d/apache2 stop
, but it only temporarily works and the server starts working again after a reboot. Is there a disable feature or something similar?
1 Answer
To stop a service doesn't prevent the deamon to start the service on boot. For this you should deactivate the service to come up on all run levels
A simple command for this on raspbian is
update-rc.d apache2 disable
If you later want the webserver starts again on default just type
update-rc.d apache2 enable
'
With the comand sudo /etc/init.d/apache2 start
you bring up the web server on demand.
-
Upvote. If the Pi is busy and should not be rebooted, the service can be stopped immediately with
sudo service apache2 stop
– SDsolarCommented Jun 6, 2018 at 20:56 -
@SDsolar, great addition! If thats fail, last option could kill the process. But this should not the way stopping a process. Commented Jun 7, 2018 at 13:22
-
I just used your
sudo update-rc.d apache2 disable
on several of my Pi3 data loggers that are in operation 24x7. They had apache2 because I had enabled it on the first one before I began cloning them. I don't reboot them unless necessary. They produce what ultimately gets out on the web at SDsolarBlog.com/montage - among their other duties. So I followed your procedure then stopped the service. All finished now, and prepared for the next eventual reboot. Thank you much for this tip.– SDsolarCommented Jun 7, 2018 at 15:55
raspbian disable apache2
(June 2018).