[Mongrel] Rotating mongrel production logs

Sean Brown seanmichaelbrown at gmail.com
Thu Feb 14 14:44:38 EST 2008

On Thu, Feb 14, 2008 at 2:08 PM, Nate Vack <njvack at wisc.edu> wrote:
> On Thu, Feb 14, 2008 at 11:29 AM, Sean Brown <seanmichaelbrown at gmail.com> wrote:
>  >         postrotate
>  >           for i in `ls /path/to/rails/root/shared/log/mongrel*.pid`; do
>  >             kill -USR2 `cat $i`
>  >           done
>  >         endscript
>  >  Incidentally, we also use monit to monitor our various processes
>  >  (mongrel, Apache, ferretDRb MySQL, etc), so if for some odd reason
>  >  this log rotation would not bring one of our mongrels back up cleanly,
>  >  we'd be alerted and monit would try to restart it.
>  Why not ask monit to restart your mongrels? It seems kind of nice to
>  have monit be the only guy in town touching the processes it
>  monitors.... but maybe there's a technical reason why not?
>  -Nate

No technical reason.  Simply timing.  Monit wakes itself every X
minutes to check if processes are running, so there could be a delay
of up X minutes until the mongrel process was restarted.  The approach
in the logrotate restarts the mongrels immediately.  Interestingly,
monit does realize that the process ID for each mongrel has changed
and alerts of that fact, but since we know that will happen every
Sunday at 3:00 AM, we can safely ignore it.


Sean Brown
seanmichaelbrown at gmail.com

More information about the Mongrel-users mailing list