user1482084
user1482084

Reputation: 325

Difference between apachectl and apache2

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?

Upvotes: 5

Views: 6956

Answers (1)

MediaVince
MediaVince

Reputation: 499

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.

Upvotes: 1

Related Questions