Strange behaviour in logging files and log rotatation, hopefully an easy answer?

Bob Brennan rbrennan96 at gmail.com
Tue May 17 15:11:05 UTC 2005


On 5/17/05, Paul Howarth <paul at city-fan.org> wrote:
> Bob Brennan wrote:
> > On 5/17/05, Paul Howarth <paul at city-fan.org> wrote:
> >
> >>Bob Brennan wrote:
> >>
> >>>On 5/17/05, Paul Howarth <paul at city-fan.org> wrote:
> >>>
> >>>>>You need to get the server to close the log file and reopen it (which
> >>>>
> >>>>will access the new file). This is usually done by using a "postrotate"
> >>>>script in logrotate that sends an appropriate signal to the server. For
> >>>>example, in the standard FC3 httpd logrotate file, there is:
> >>>>
> >>>>    postrotate
> >>>>        /bin/kill -USR1 `cat /var/run/httpd.pid 2>/dev/null` 2>
> >>>>/dev/null || /bin/true
> >>>>    endscript
> >>>
> >>>
> >>>Thanks Paul - looking in my own logrotate file for httpd I find:
> >>>"/bin/kill -USR1 `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true"
> >>>as the postrotate command, nearly the same as your line except for the
> >>>/bin/true part.
> >>>
> >>>I will put that postrotate command into my less critical site's
> >>>logrotate files and see what happens over the next few days, then put
> >>>it into all logrotates that exhibit the problem.
> >>
> >>The "|| true" probably won't make any difference; it just keeps
> >>logrotate happy that the script has run, even if there's been an error.
> >>
> >>Are you sure that /var/run/httpd.pid has the PID of your httpd process?
> >
> >
> > $ pidof httpd
> > 19554 19305 19212 19208 19186 19180 19054 19006 15738 3888
> >
> > /var/run/httpd.pid has only "3888" in it
> >
> > is this correct?
> 
> If you do:
> 
> $ ps uax -H
> 
> does it show all the other processes being children of 3888? If so,
> that's OK.

root      3888  0.0  2.7 28164 14016 ?       Ss   May14   0:02   /usr/sbin/httpd
apache   19006  0.2  4.5 39056 23492 ?       S    10:15   0:57    
/usr/sbin/httpd
apache   19054  0.3  4.4 38472 22916 ?       S    10:58   0:56    
/usr/sbin/httpd
apache   19180  0.2  4.4 38584 23076 ?       S    11:24   0:48    
/usr/sbin/httpd
apache   19186  0.3  4.4 38540 22976 ?       S    11:26   0:56    
/usr/sbin/httpd
apache   19208  0.3  4.4 38540 22984 ?       S    11:30   0:52    
/usr/sbin/httpd
apache   19212  0.2  4.5 38772 23336 ?       S    11:30   0:41    
/usr/sbin/httpd
apache   19305  0.3  4.4 38484 22988 ?       S    11:31   0:57    
/usr/sbin/httpd
apache   19554  0.2  4.4 38584 23144 ?       S    12:42   0:36    
/usr/sbin/httpd

looks ok! (?)

bob




More information about the users mailing list