LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-22-2010, 01:39 PM   #1
the_gorf
LQ Newbie
 
Registered: Jun 2004
Location: Seattle Washington
Distribution: Arch, CentOS, debian
Posts: 7

Rep: Reputation: 0
logrotate for httpd breaks HTTP sessions


We started hosting some very large content on our site, and the usage patterns in cacti have revealed that the HTTP sessions through our load-balancers drop off dramatically right at midnight. I'm not sure if I am expecting this to be normal behaviour. The logrotate process runs right at midnight, and issues a reload command through the service tool (CentOS 5.5):

Code:
$ cat /etc/logrotate.d/httpd
/data/websites/logs/*_log /var/log/httpd/*log {
missingok
daily
dateext
compress
rotate 7
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}
Looking at the init script reveals that the reload section is suppose to trigger a HUP of the httpd process:

Code:
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=$?
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
    fi
    echo
}
In which, Apache should reload it's configuration and start the new logfile without breaking current sessions. However that clearly isn't what is going on. Anyone able to offer any insight here? I'm tempted to edit the logrotate script to trigger a HUP directly by cat'ing the PID file directly.

Is this normal behavior for Apache when signaled with a HUP?
 
Old 12-22-2010, 04:12 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,221
Blog Entries: 1

Rep: Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075
Hi,

You can use graceful instead of restart (that is the same to the reload() function, as they both use the kill -HUP signal).
Code:
httpd -k graceful
Take a look here and here for more details.

Regards

Last edited by bathory; 12-22-2010 at 04:20 PM. Reason: add 2nd link
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] httpd not restarting at logrotate (seg fault or similar nasty error) niels.horn Slackware 12 04-03-2011 12:44 AM
httpd sessions never terminate lhiggie1 Linux - Server 3 12-11-2010 09:22 AM
logrotate httpd log files linux_bud Linux - Newbie 3 01-11-2010 05:13 AM
logrotate breaks syslogd neocontrol Linux - Software 1 03-05-2007 10:36 AM
httpd kill http but not https vcheah Linux - Software 3 06-27-2004 09:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration