RE: [users@httpd] Apache restarts on logrotate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
see http://httpd.apache.org/docs/1.3/stopping.html
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
-l"

$ 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 [mailto:chidanand.gangur@xxxxxxxxx]
Sent: Friday, August 25, 2006 9:37 AM
To: users@xxxxxxxxxxxxxxxx
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
problem? 

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
22202/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657655
9190/httpd          
unix  2      [ ]         STREAM     CONNECTED     8657654
22231/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657653
669/httpd           
unix  2      [ ]         STREAM     CONNECTED     8657643
7228/httpd          
unix  2      [ ]         STREAM     CONNECTED     8657642
28418/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657640
412/httpd           
unix  2      [ ]         STREAM     CONNECTED     8657637
32393/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657636
25979/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657635
19223/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657634
17688/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657628
5491/httpd          
unix  2      [ ]         STREAM     CONNECTED     8657623
10928/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657622
30138/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657620
514/httpd           
unix  2      [ ]         STREAM     CONNECTED     8657618
16177/httpd         
unix  2      [ ]         STREAM     CONNECTED     8657613
25896/httpd         



-- 
Chidanand Gangur
Pune. 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux