httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: [users@httpd] Apache restarts on logrotate
Date Fri, 25 Aug 2006 08:20:24 GMT
On Unix systems most daemon processes are written to trap a
SIGHUP sent to their proccess ID (PID)
and reinitialize.
This is common behaviour and handy if you either need to
propagate a change in the daemon's configuration,
or want it to release locks or file handles.
The latter is mostly required if you need to rotate logfiles of
these processes,
and thus also used by logrotate.
You can look for logrotate's config file to change this.
Usually it is either in a single file like /etc/logrotate.conf,
or on many Linux systems spread over several files separated per
service like
e.g. /etc/logrotate.d/httpd or /etc/logrotate.d/apache
The apache httpd is written to not only trap a SIGHUP but also a
SIGUSR1 (a userdefined signal).
How it behaves differently on reception of these signals can be
read here
Usually the graceful restart is to be preferred but it depends on
what you are
doing with the old logfile immediately after rotation (e.g. like
zipping or post processing,
read warning note in above doc)
On a Unix system the command "kill"
(which is a real misnomer and rather should have been named
something like "sendsig")
will list you all known signals along with their numbers by "kill

$ kill -l|grep -i usr1
 9) SIGKILL     10) SIGUSR1     11) SIGSEGV     12) SIGUSR2

On a Linux box you can invoke a graceful restart like

# pkill -10 -u 0 -P 1 -x httpd
# tail -3 /var/log/httpd/error_log 
[Fri Aug 25 10:15:53 2006] [notice] SIGUSR1 received.  Doing
graceful restart
[Fri Aug 25 10:15:53 2006] [notice] Apache/1.3.27 (Unix)
PHP/4.4.1 configured -- resuming normal operations
[Fri Aug 25 10:15:53 2006] [notice] Accept mutex: sysvsem
(Default: sysvsem)

-----Original Message-----
From: Chidanand Gangur []
Sent: Friday, August 25, 2006 9:37 AM
Subject: [users@httpd] Apache restarts on logrotate

Hi all,

I have configured apache with php and ssl. I have statically
linked them in apache and using it for an embedded application. I
have also configured logrotate to rotate the log files when the
access_log/error_log reaches to 5M.

I am using apache-1.3.34.
Many times I see the following message in my error_log file.

[notice] SIGHUP received.  Attempting to restart

after googling I found that SIGHUP is sent by logrotate when it
clears and backups the file.

I see this event every often. 

Does the process actually get restarted,  or is reloaded?

Some times I see that apache process hangs with limit of
MaxClient reached. This condition sometime recovers over the
period of time and some time does not.

Is that the frequent restart of apache process causing this

When the condition arises I also tried to do netstat I see lot of
stream sockets in connected state. UNIX stream sockets are
openened in PHP script to talk to othe r modules in the system.

unix  2      [ ]         STREAM     CONNECTED     8657659
unix  2      [ ]         STREAM     CONNECTED     8657655
unix  2      [ ]         STREAM     CONNECTED     8657654
unix  2      [ ]         STREAM     CONNECTED     8657653
unix  2      [ ]         STREAM     CONNECTED     8657643
unix  2      [ ]         STREAM     CONNECTED     8657642
unix  2      [ ]         STREAM     CONNECTED     8657640
unix  2      [ ]         STREAM     CONNECTED     8657637
unix  2      [ ]         STREAM     CONNECTED     8657636
unix  2      [ ]         STREAM     CONNECTED     8657635
unix  2      [ ]         STREAM     CONNECTED     8657634
unix  2      [ ]         STREAM     CONNECTED     8657628
unix  2      [ ]         STREAM     CONNECTED     8657623
unix  2      [ ]         STREAM     CONNECTED     8657622
unix  2      [ ]         STREAM     CONNECTED     8657620
unix  2      [ ]         STREAM     CONNECTED     8657618
unix  2      [ ]         STREAM     CONNECTED     8657613

Chidanand Gangur

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message