I have tried to restart my Apache server, I am new to this. I am curious to know what does apache2 restart does? what does apachectl restart do?
-
2Please provide the path to both commands, and what OS you're using. A blind guess is your "apache2" command is from your distribution, and it calls out the "apachectl" command. – Corey Henderson May 02 '13 at 15:10
-
1Under Debian for instance `/etc/init.d/apache2` is a script using the script `/usr/sbin/apachectl` which calls the symlink `/usr/sbin/apache2` which links to either the worker or prefork apache2 binary in `/usr/lib/apache2/mpm-(prefork|worker|event)/apache2` – Wrikken May 02 '13 at 19:15
1 Answers
Assuming you are on Ubuntu or the likes, a man apache2
indicates the following:
In general, apache2 should not be invoked directly, but rather should be invoked via /etc/init.d/apache2 or apache2ctl.
FYI: apachectl is an alias of apache2ctl nowadays
As a best practice, it is advised to issue sudo apache2ctl graceful
The graceful argument, as is intended by its meaning, offers a more stable way to restart the apache process by letting its child processes finish ongoing tasks before reloading the configurations.
cf man apache2ctl
restart:
Restarts the Apache daemon by sending it a SIGHUP.
graceful:
Gracefully restarts the Apache daemon by sending it a SIGUSR1. If the daemon is not running, it is started. This differs from a normal restart in that currently open connections are not aborted.
Here is a reference about signalling SIGUSR1 as opposed to SIGHUP.

- 1
- 1

- 479
- 1
- 8
- 13