/etc/init.d/apache2 stop | start | restart works but I was looking in the man pages for apache and apache2, and the only thing I could see was:
apache2ctl stop | start | ...
Can someone provide an explanation of the second command and why it doesn't work?
You CAN use apachectl through a simple bash script, to simply wrap the calls. I.e., /etc/init.d/httpd has a start command that calls
apachectl start
, etc..HOWEVER, most Linux distributions provide their own init script, /etc/init.d/httpd (or similar), that uses the SysV macros such as daemon, killproc, etc.. So basically, they do the same thing, but are provided/maintained by different groups. In general, I personally prefer the init script simply because its more in line with the rest of the daemons on my system.
Hope this clarifies things for you!
Andrew
We don't use the apachectrl script and I maintain a Linux distribution.
We start apache by calling HTTPD directly and before starting, we make sure it's not already running and there is no PID file left behind.
To stop Apache (httpd), we send it the kill -TERM command.
We've been doing it this way for many, many years -- it just works for us this way. Simple and easy...