Hello, before monit calls the stop program, it checks whether the process is running - if not, then the stop program is intentionally skipped (optimization).
If you need to always call stop before start, you can put it to the start program like this: --8<-- start program = "/bin/bash -c '/tmp/stop_service.sh && /tmp/start_service.sh'" --8<-- Regards, Martin On Apr 17, 2012, at 10:45 AM, jing ping wrote: > Hello, > > I configured a monit control file to restart a service in case the service > is stopped accidentally. > > check process servicea with pidfile /var/run/servicea.pid > start program = "/tmp/start_service.sh" > stop program = "/tmp/stop_service.sh" > if does not exist then restart > > # add connection checking > if failed port 80 type tcp then restart > > >From the monit guide, restart action shall call stop, then start program > >defined. If failed to check port, monit did stopped the service, then > >started it. However, in "does not exist" case, only start program was > >invoked. Is it expectable? As I want to send alarm in stop program when > >detect the service has gone, is there another way to trigger both stop and > >start if restart can't do? > > Thanks, > > Jing > > -- > To unsubscribe: > https://lists.nongnu.org/mailman/listinfo/monit-general
-- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
