I've started using Monit a few days ago and have met a problem that I have not been able to find a work around so far.
I'm trying to make Monit monitor a program of mine and I want it to :
- restart it as long as it does not return the error Code 0
- unmonitor it as soon as it returns 0.
However, when getting the error code 0, instead of just unmonitoring my app, Monit restarts it one last time and then unmonitor it.
I don't want my app to be restarted when unmonitored, how can I do that ?
My monitrc file :
check program LidarServer with path "/path/to/my/app"
if status = 0 then unmonitor
if status != 0 then restart