Christopher Thorjussen
2010-Jan-15 09:35 UTC
[CentOS] Logrotate in CentOS 5.4 more brutal (to httpd at least) than in 5.3?
I've just updated a few CentOS 5.3 servers to 5.4. One of them were a Apache Webserver. Doing a diff/check on the new ".rpmnew" config files that are made, I saw that the logrotate command for apache was changed. In 5.3 it did a reload, but in 5.4 it does a hard kill: CentOS 5.3: /var/log/httpd/*log { missingok notifempty sharedscripts postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript } CentOS 5.4: /var/log/httpd/*log { missingok notifempty sharedscripts postrotate /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true endscript } Isn't this a bit harsh in 5.4? Wouldn't the 5.3 method be better? -Christopher Thorjussen
Peter Kjellstrom
2010-Jan-15 10:47 UTC
[CentOS] Logrotate in CentOS 5.4 more brutal (to httpd at least) than in 5.3?
On Friday 15 January 2010, Christopher Thorjussen wrote:> I've just updated a few CentOS 5.3 servers to 5.4. One of them were a > Apache Webserver. Doing a diff/check on the new ".rpmnew" config files that > are made, I saw that the logrotate command for apache was changed. In 5.3 > it did a reload, but in 5.4 it does a hard kill:5.4 does a "kill -HUP" which is what "service httpd reload" does too. The -HUP signal causes http to re-read stuff rather than shutting down. Still, I don't really understand why 5.4 doesn't use "service reload" which seems more "correct" (and the init.d script does a little bit of checking before the kill -HUP too). *shrug* Peter> CentOS 5.3:...> postrotate > /sbin/service httpd reload > /dev/null 2>/dev/null || true> CentOS 5.4:...> postrotate > /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || > true endscript-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. URL: <http://lists.centos.org/pipermail/centos/attachments/20100115/69d23564/attachment-0001.sig>
Arturas Skauronas
2010-Jan-15 12:08 UTC
[CentOS] Logrotate in CentOS 5.4 more brutal (to httpd at least) than in 5.3?
On Fri, Jan 15, 2010 at 11:35 AM, Christopher Thorjussen <Christopher.Thorjussen at carrot.no> wrote:> I've just updated a few CentOS 5.3 servers to 5.4. One of them were a Apache Webserver. Doing a diff/check on the new ".rpmnew" config files that are made, I saw that the logrotate command for apache was changed. In 5.3 it did a reload, but in 5.4 it does a hard kill: > > CentOS 5.3: > > /var/log/httpd/*log { > ? ? ? ?/sbin/service httpd reload > /dev/null 2>/dev/null || true > CentOS 5.4: > > /var/log/httpd/*log { > ? ? ? ?/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || truestrange, because in my systems it does service reload logrotate-3.7.4-9
Brian Mathis
2010-Jan-15 17:31 UTC
[CentOS] Logrotate in CentOS 5.4 more brutal (to httpd at least) than in 5.3?
On Fri, Jan 15, 2010 at 4:35 AM, Christopher Thorjussen <Christopher.Thorjussen at carrot.no> wrote:> I've just updated a few CentOS 5.3 servers to 5.4. One of them were a Apache Webserver. Doing a diff/check on the new ".rpmnew" config files that are made, I saw that the logrotate command for apache was changed. In 5.3 it did a reload, but in 5.4 it does a hard kill: > > CentOS 5.3: > > /var/log/httpd/*log { > ? ?missingok > ? ?notifempty > ? ?sharedscripts > ? ?postrotate > ? ? ? ?/sbin/service httpd reload > /dev/null 2>/dev/null || true > ? ?endscript > } > > > CentOS 5.4: > > /var/log/httpd/*log { > ? ?missingok > ? ?notifempty > ? ?sharedscripts > ? ?postrotate > ? ? ? ?/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true > ? ?endscript > } > > Isn't this a bit harsh in 5.4? Wouldn't the 5.3 method be better? > > -Christopher ThorjussenThe "kill" command is misnamed and has undoubtedly cause this kind of confusion since its inception. What the kill command really does is send a signal to the process. By default it just happens to be the TERM signal. If you give it another signal, like HUP, it will send that one instead. It's up to the individual program to determine what to do when receiving certain signals. In the case of HUP, many programs choose to reload their configurations. "dd" is interesting in that it prints out status information when it receives a USR1 signal. I agree that it should be using "service" instead of kill though.
Matthew Miller
2010-Feb-03 18:49 UTC
[CentOS] Logrotate in CentOS 5.4 more brutal (to httpd at least) than in 5.3?
On Fri, Jan 15, 2010 at 11:47:40AM +0100, Peter Kjellstrom wrote:> 5.4 does a "kill -HUP" which is what "service httpd reload" does too. The -HUP > signal causes http to re-read stuff rather than shutting down. > Still, I don't really understand why 5.4 doesn't use "service reload" which > seems more "correct" (and the init.d script does a little bit of checking > before the kill -HUP too).That said, *both* of them are too brutal, in that they'll kill any open connections. Signal USR1 (or service httpd graceful) is much nicer, since it lets any open connections complete. The downside is that these old connections might get written to the _rotated_ log instead of the new one, but to me that's a small price to pay. -- Matthew Miller mattdm at mattdm.org <http://mattdm.org/>