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

Paul Howarth paul at city-fan.org
Tue May 17 13:53:34 UTC 2005


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.

Paul.




More information about the users mailing list