[ale] Cooperating with logrotate
JK
jknapka at kneuro.net
Fri Nov 6 14:33:31 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, that's what I'm looking at doing. Only problem is, it's a Java
program and there doesn't seem to be any way of installing a signal
handler, short of resorting to native code. But I already have some
other channels for signaling the process, so it's doable.
Muchos gracias,
-- JK
More information about the Ale
mailing list