Note that there are some explanatory texts on larger screens.

plurals
  1. POMonit - how to identify crashes of a program instead of restarts
    primarykey
    data
    text
    <p>I am using monit to monitor my program. The program being monitored can potentially crash under 2 situations</p> <ul> <li>Program can randomly crash. It just needs to be restarted</li> <li>It gets into a bad state and crashes each time it is started subsequently</li> </ul> <p>To fix the latter situation, I have a script to stop the program, reset it to a good state by cleaning its data files and restart it. I tried the below config</p> <pre><code>check process program with pidfile program.pid start program = "programStart" as uid username and gid groupname stop program = "programStop" as uid username and gid groupname if 3 restarts within 20 cycles then exec "cleanProgramAndRestart" as uid username and gid groupname if 6 restarts within 20 cycles then timeout </code></pre> <p>Say monit restarts the program 3 times in 3 cycles. After it is restarted the third time, the <strong>cleanProgramAndRestart</strong> script runs. However as the cleanProgramAndRestart script restarts the program yet again, the condition of 3 restarts is met again in the next cycle and it becomes an infinite loop</p> <p>Could anyone suggest any way to fix this? </p> <p>If any of the below actions are possible, then there may be a way around.</p> <ul> <li>If there is a "crash" keyword, instead of "restarts", I will be able to run the clean script after the program <strong>crashes</strong> 3 times instead of after it is <strong>restarted</strong> 3 times</li> <li>If there is a way to reset the "restarts" counter in some way after running the exec script</li> <li>If there is a way to exec something only if output of the condition <strong>3 restarts</strong> changed</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload