My configuration is using monit 4.10-beta-1 on RHEL3. I have configured a dependency chain for squid and apache:

squid ---depends-on--> apache

Squid in particular can take a while to shutdown. In fact the official squid init.d script contains a section that looks like this:

timeout=0
while : ; do
   [ -f /opt/squid/var/logs/squid.pid ] || break
   if [ $timeout -ge $SQUID_SHUTDOWN_TIMEOUT ]; then
       echo
       return 1
   fi
   sleep 2 && echo -n "."
   timeout=$((timeout+2))
done

When I issue a 'monit restart apache' command, I see the following in stdout:

'squid' stop: /etc/init.d/squid.local
Stopping squid: 'apache' stop: /usr/local/bin/stop-apache.bash
.                                                          [  OK  ]

Which tells me that the 'apache stop' is being executed before the 'squid stop' has actually completed. If the commands were executed serially, the output would have been:

'squid' stop: /etc/init.d/squid.local
Stopping squid: ......                     [ OK ]
'apache' stop: /usr/local/bin/stop-apache.bash

This seems similar to what is described:
http://lists.nongnu.org/archive/html/monit-general/2007-04/msg00007.html

Would it be possible to add a 'synchronous' flag to the start/stop parameters to force monit to wait for the script to exit fully:

start synchronous "/etc/init.d/service start"
stop synchronous "/etc/init.d/service stop"

Or something to that effect?

-jason






--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Reply via email to