monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

apache restart while rotating logs


From: Charles Fry
Subject: apache restart while rotating logs
Date: Sat, 05 Mar 2005 08:50:21 -0500
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Hi,

First of all, let me express my appreciation for monit. It took me a while to find it, but I have much enjoyed it.

My current problem is that monit regularly restarts apache while my logs are being rotated. I am running a Debian system installed on a low-memory UML server. My monitrc contains essentially the following recipe:

check process apache2 with pidfile /var/run/apache2.pid
    start program = "/etc/init.d/apache2 start"
    stop  program = "/etc/init.d/apache2 stop"

As far as I can tell, this happens because /etc/logrotate.d/apache2 calls "/etc/init.d/apache2 restart"" which executes the following:

    echo -n "Forcing reload of web server: Apache2"
    apache_stop
    sleep 10
    $APACHE2CTL startssl
    echo "."

During those 10 sleep seconds, monit notices the missing pid and impatiently restarts apache, even though the init script is also in the process of restarting apache. Obviously this inevitably leads to errors, in addition to a wasteful restart of apache, which is already restarting.

I was hoping that there would be a way to tell monit "wait for x seconds and then if you still can't find the pid file, restart this process." I see the syntax for doing this in the case of failed connections, but not for missing pids.

I realize that I could also modify my logrotate script to execute "monit restart apache2" when rotating my logs. The problem with this is that it does not insert the 10 second wait between the start and stop, as the init.d restart does, so apache hasn't finished shutting down when the start is attempted, and the start fails. This thus puts me in a worse situation than before, as I must wait for monit's next polling cycle before the failed apache (brought down by monit) is found and restarted.

Any assistance would be appreciated.

thanks,
Charles

--
Is he
Lonesome
Or just blind--
This guy who drives
So close behind?
Burma-Shave
http://frogcircus.org/burmashave/1952/is_he




reply via email to

[Prev in Thread] Current Thread [Next in Thread]