Apache - Restart apache gracefully using apachectl, Apachectl start | stop | restart | graceful
Restart apache gracefully using apachectlThe below command will restart the apache gracefully. It the apache is started already then it will report that the port is already occupied by the service.
# /usr/sbin/apachectl graceful
If Apache is not already running it will be started. If it is already running then it will reload with the new changes but will not abort active connections, meaning that anyone who is in the middle of downloading something will continue to be able to download it.
To test the apache configuration file
# /usr/sbin/apachectl configtest Output: Syntax OK
This will check the httpd.conf file and report whether the syntax of the file is valid or not. A list of errors will be displayed including the line numbers if there are any. This makes it easy to isolate any problems.
The following are all the available options that can be passed to the apachectl command. This text is from the apachectl man page.
apachectl start: Start the Apache daemon. Gives an error if it is already running.
apachectl stop: Stops the Apache daemon.
apachectl restart: Restarts the Apache daemon by sending it a SIGHUP. If the daemon is not running, it is started. This command automatically checks the configuration files via configtest before initiating the restart to make sure Apache doesn't die.
fullstatus: Displays a full status report from mod_status. For this to work, you need to have mod_status enabled on your server and a text-based browser such as lynx available on your system. The URL used to access the status report can be set by editing the STATUSURL variable in the script.
apachectl status: Displays a brief status report. Similar to the fullstatus option, except that the list of requests currently being served is omitted.
apachectl 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. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them. This command automatically checks the configuration files via configtest before initiating the restart to make sure Apache doesn't die.
apachectl configtest: Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error.
apachectl help: Displays a short help message.
The topic on Apache - Restart apache gracefully using apachectl is posted by - Math
Hope you have enjoyed, Apache - Restart apache gracefully using apachectlThanks for your time