Archive for the tag 'graceful'

How to enable Apache graceful restart in Plesk

APPLIES TO:

Parallels Plesk Panel 11.0 for Linux
Parallels Plesk Panel 10.4 for Linux/Unix
Parallels Plesk Panel 10.3 for Linux/Unix

By default, Parallels Plesk Panel does not use Apache graceful restart for applying new settings.

Solution:

To enable graceful restart, you should add the parameter “restart_apache_gracefully” with a “true” value to the “misc” table of the “psa” database. It can be done by the following SQL query:

mysql> INSERT INTO misc VALUES (’restart_apache_gracefully’, ‘true’);

How to enable Apache graceful restart in Plesk

APPLIES TO:

Parallels Plesk Panel 11.0 for Linux
Parallels Plesk Panel 10.4 for Linux/Unix
Parallels Plesk Panel 10.3 for Linux/Unix

Symptoms
By default, Parallels Plesk Panel does not use Apache graceful restart for applying new settings.

Resolution
To enable graceful restart, you should add the parameter “restart_apache_gracefully” with a “true” value to the “misc” table of the “psa” database. It can be done by the following SQL query:

mysql> INSERT INTO misc VALUES (’restart_apache_gracefully’, ‘true’);
SBDavid

Apache Graceful Restart Process

Apache Graceful Restart Process

Signal: USR1

apachectl -k graceful

The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they’re not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.

This code is designed to always respect the process control directive of the MPMs, so the number of processes and threads available to serve clients will be maintained at the appropriate values throughout the restart process.

How to change apache to do graceful restarts in DirectAdmin

To do that, you’ll need to change your httpd boot script.
The path for your script will vary depending on your OS.

For FreeBsd it’s:
/usr/local/etc/rc.d/httpd

For all other OS’s, it’s:
/etc/init.d/httpd

As for the actual change, you’ll edit the httpd boot script for your system, find this code:

restart)
stop
waitforexit “httpd” 20
start
;;

and change it to read:

restart)
kill -USR1 `cat $PIDFILE`
;;

An apache restart will no longer start apache if it’s stopped. You must “start” it, as the graceful restart only works on already running processes.

Source : http://directadmin.com