小编Atl*_*s1j的帖子

当受监控的进程失败时,如何让 monit 执行多项操作?

我有一个我想用 monit 监控的自定义服务。当进程失败时,我想将日志复制到共享文件系统并重新启动服务。类似于以下内容,但我不确定是什么。任何提示将不胜感激。

check process pipeline with pidfile /var/run/pipeline.pid
   start program = "/sbin/start pipeline"
   stop  program = "/sbin/stop pipeline"
   if 10 restarts within 10 cycles then timeout
   # Not sure what to write next
   if <service has failed> 
      restart and 
      exec "/bin/bash -c 'cp /var/log/upstart/pipeline.log /nfs/logs/`hostname`.`date +'%m-%d-%Y_%H.%M.%S'`.log'"
Run Code Online (Sandbox Code Playgroud)

linux monit

6
推荐指数
1
解决办法
9182
查看次数

标签 统计

linux ×1

monit ×1