Introduction
In order to stop or restart Apache, you must send a signal to the running
httpd
processes. There are two ways to send the signals. First, you can use the unix kill
command to directly send signals to the processes. You will notice many httpd
executables running on your system, but you should not send signals to any of them except the parent, whose pid is in the PidFile
. That is to say you shouldn't ever need to send signals to any process except the parent. There are four signals that you can send the parent: TERM
, USR1
, HUP
, and WINCH
, which will be described in a moment.To send a signal to the parent you should issue a command such as:
kill -TERM `cat /usr/local/apache2/logs/httpd.pid`
The second method of signaling the
httpd
processes is to use the -k
command line options: stop
, restart
, graceful
and graceful-stop
, as described below. These are arguments to the httpd
binary, but we recommend that you send them using the apachectl
control script, which will pass them through to httpd
.After you have signaled
httpd
, you can read about its progress by issuing:tail -f /usr/local/apache2/logs/error_log
Modify those examples to match your
ServerRoot
and PidFile
settings.Stop Now
- Signal: TERM
apachectl -k stop
Sending the
TERM
or stop
signal to the parent causes it to immediately attempt to kill off all of its children. It may take it several seconds to complete killing off its children. Then the parent itself exits. Any requests in progress are terminated, and no further requests are served.Graceful Restart
- 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../httpd -k graceful-stop
./httpd -k graceful-stop
./httpd -k restart
How to start the server as a UNIX service
- Put your shell commands in a startup file in /etc/rc2.d directly, keep in mind that files residing in /etc/rc2.d follow some rules i.e. filenames starting with S are startup scripts while starting with K are kill scripts, after S or K prefix there comes a 2 digit number like S10 or S65, it tells rc the sequence of startup scripts, so I'll suggest you to give it a name like S99xyz so that it runs in the last and doesn't disturb any other sequence and also is displayed at the bottom of the list of directory.
- Second way is that create a symbolic link for your script suppose it is at path /home/t1.sh and /etc/rc2.d/S99t1.sh(Startup file
No comments:
Post a Comment