Hi,
                I have the following use case, where I don't want certain 
application to take more than a certain amount of memory. If it ever exceeds 
for any reason I want it to restart. So I have the following configuration in 
monitrc

Check process my-process matching 'my-process'
  start program "/etc/init.d/S77-my-process start" with timeout 10 seconds
  stop program "/etc/init.d/K23-my-process stop"
  if memory usage > 12.0 MB for 4 cycles then restart
  if 5 restarts within 5 cycles then unmonitor

So when the memory exceeds the stated limit I see that the stop script is 
called but monit does not wait for the stop script to complete. Monit looks 
like just waits for the process it was monitoring (my-process) to be killed and 
once it detects that, it calls the start program.
I have few cleanup steps to do after the process has been killed before it can 
be started again (which happens in the stop script) however it is started 
before the cleanup is complete.

I tried changing the action as below to execute a script for restart however 
the last line, if 5 restarts within 5 cycles then unmonitor does not seem to 
work.
if memory usage > 12.0 MB for 4 cycles then exec "/etc/init.d/S77-my-process 
restart"

Do you guys have any suggestion for this use case?

Thanks
Shankar

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

Reply via email to