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

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


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?

Paul.




More information about the users mailing list