Matthew Wilson
2009-02-22 17:37:38 UTC
This is a funky problem, and vaguely off-topic.
My webapp writes to five different log files in a directory. I use
logrotate to rotate the log files daily and then restart my web app.
The logrotate config looks sort of like:
/var/log/turbogears/*.log {
# Rotate the logs every day.
daily
# Now tell supervisord to restart all these scripts, so that they
# don't keep logging to the old files.
postrotate
supervisorctl restart webapp
endscript
}
Here's the problem: since I have five log files to rotate, logrotate
restarts my app five times!
Is there some cool way to tell supervisor that it should only restart
my webapp if the process is more than, say, one hour old? Then the
needless restarts would get ignored.
There's probably a solution to this that involves writing a better
logrotate config, but I haven't figured that out either.
All comments welcome! supervisor is great software.
Matt
My webapp writes to five different log files in a directory. I use
logrotate to rotate the log files daily and then restart my web app.
The logrotate config looks sort of like:
/var/log/turbogears/*.log {
# Rotate the logs every day.
daily
# Now tell supervisord to restart all these scripts, so that they
# don't keep logging to the old files.
postrotate
supervisorctl restart webapp
endscript
}
Here's the problem: since I have five log files to rotate, logrotate
restarts my app five times!
Is there some cool way to tell supervisor that it should only restart
my webapp if the process is more than, say, one hour old? Then the
needless restarts would get ignored.
There's probably a solution to this that involves writing a better
logrotate config, but I haven't figured that out either.
All comments welcome! supervisor is great software.
Matt
--
Matthew Wilson
***@tplus1.com
http://tplus1.com
Matthew Wilson
***@tplus1.com
http://tplus1.com