Bug 13498 - logrotate script tries to restart not-running httpd
Summary: logrotate script tries to restart not-running httpd
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: apache
Version: 6.0
Hardware: i386
OS: Linux
low
low
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-07-05 13:47 UTC by ecashin
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-07-05 13:47:11 UTC
Embargoed:


Attachments (Terms of Use)

Description ecashin 2000-07-05 13:47:08 UTC
As it stands, the logrotate script tries to restart httpd after rotating
the apache logs even when the daemon is not running.  On machines where
the web server is not always running, that means that an error message
shows up in the logs every so often.

The following patch on /etc/logrotate.d/apache uses /sbin/pidof, of the
SysVinit rpm, to test whether the daemon is running before attempting the
restart:

*** /tmp/apache.orig	Wed Jul  5 09:26:19 2000
--- /tmp/apache	Wed Jul  5 09:28:09 2000
***************
*** 1,27 ****
  /var/log/httpd/access_log {
      missingok
      postrotate
! 	/usr/bin/killall -HUP httpd
      endscript
  }
  
  /var/log/httpd/agent_log {
      missingok
      postrotate
! 	/usr/bin/killall -HUP httpd
      endscript
  }
  
  /var/log/httpd/error_log {
      missingok
      postrotate
! 	/usr/bin/killall -HUP httpd
      endscript
  }
  
  /var/log/httpd/referer_log {
      missingok
      postrotate
! 	/usr/bin/killall -HUP httpd
      endscript
  }
--- 1,27 ----
  /var/log/httpd/access_log {
      missingok
      postrotate
! 	if [ "`/sbin/pidof httpd`" != "" ]; then /usr/bin/killall -HUP httpd; fi
      endscript
  }
  
  /var/log/httpd/agent_log {
      missingok
      postrotate
! 	if [ "`/sbin/pidof httpd`" != "" ]; then /usr/bin/killall -HUP httpd; fi
      endscript
  }
  
  /var/log/httpd/error_log {
      missingok
      postrotate
! 	if [ "`/sbin/pidof httpd`" != "" ]; then /usr/bin/killall -HUP httpd; fi
      endscript
  }
  
  /var/log/httpd/referer_log {
      missingok
      postrotate
! 	if [ "`/sbin/pidof httpd`" != "" ]; then /usr/bin/killall -HUP httpd; fi
      endscript
  }

Comment 1 Nalin Dahyabhai 2000-07-05 15:39:01 UTC
This is already fixed in a different way in the development tree.


Note You need to log in before you can comment on or make changes to this bug.