[ale] Cooperating with logrotate
Jim Lynch
ale_nospam at fayettedigital.com
Fri Nov 6 15:50:59 EST 2009
Brandon Checketts wrote:
> The process that is writing to the log needs to close and reopen the file
> handle. Most applications support sending a HUP signal to tell the process to
> reload its configuration, reopen log files, etc. If this is a custom program,
> then you would likely have to add support for that. The exact method for doing
> so depends on the language.
>
> Once you know how to get your application to reopen the log, then you would use
> a postrotate script in the logrotate config to trigger that. As an example, the
> logrotate config for Apache does this:
>
> postrotate
> /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
> endscript
>
> Thanks,
> Brandon Checketts
>
>
A related question, what happens to a threaded program that gets the
HUP? Do all threads have to catch the signal and process them?
Jim.
More information about the Ale
mailing list