我在Linux机器上使用了Monit 5.3.2。 我正在使用Monit监视一些服务。 我想在运行重新启动命令之前运行一个脚本。 我已经使用了相同的下面的条件。
if does not exist for 2 times within 3 cycles then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser if does not exist for 10 cycles then restart
不幸的是,只有重新启动操作正在执行。
任何人都可以请帮我确定为什么第一条规则不被执行? 还有别的办法可以解决这个问题吗?
这不是一个明确的答案,因为我是一个正在追逐类似问题的新手。
我现在怀疑最后一条规则会覆盖所有以前的规则。
如果是这样,请尝试:
if does not exist for 2 times within 3 cycles then exec "/bin/bash -c 'touch /tmp/somefile'" as uid someuser and gid someuser ELSE if does not exist for 10 cycles then restart