> I am experimenting with dependencies to see how I can
> use them to meet a customer requirement.
> I have the following in my monitrc file:
> check process dummy with pidfile /var/run/dummy.pid
> mode passive
> check process squid with pidfile /var/run/squid.pid
> start program = "/etc/init.d/squid start"
> stop program = "/etc/init.d/squid stop"
> depends on dummy
> On a "monit start all", even when the file /var/run/dummy.pid
> doesn't exist, monit still starts squid.
> I thought that squid would not be started until dummy was running
> (i.e., until the pid file was present.)
> What am I missing?
Monit performs in-order startup, however it doesn't check whether the
parent realy started or not in the same cycle.
What happens is:
1.) try to start the service 'dummy' (there's no startup script and the
mode is passive so just the monitoring will be enabled). In the case
that 'squid' was running, it will be stopped, then 'dummy' monitoring
enabled and then 'squid' started.
2.) try to start the service 'squid'. Because the 'dummy' is
prerequisite, monit will check whether it is running or not. Because it
is not running, it will try to start the 'dummy' (enable monitoring) and
then 'squid' (run startup script). However, in between 'dummy' and
'squid' monit doesn't check that the 'dummy' realy started (the failure
will be detected next cycle).
i.e. monit currently ensures correct sequence, but doesn't wait for
'dummy' to start before trying to start 'squid'.