[Supervisor-users] Can supervisor restart conditionally based on process age?
Matthew Wilson
matt at tplus1.com
Sun Feb 22 12:37:38 EST 2009
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
--
Matthew Wilson
matt at tplus1.com
http://tplus1.com
More information about the Supervisor-users
mailing list