Monit无法启动进程:(退出状态0)-无输出

时间:2018-07-31 13:52:02

标签: linux monit

我的monitrc文件中具有以下配置。

check process api-gateway with pidfile /var/run/apigateway.pid
    start program = "/bin/bash -c '/apigateway/gatewayscript start'"
    stop program = "/bin/bash -c '/apigateway/gatewayscript stop'"

这是我用来启动/停止过程的脚本:

#!/bin/bash

 case $1 in
    start)
       exec 2>&1 /apigateway/./api-gateway &
       echo $$ > /var/run/apigateway.pid ;
       ;;
     stop)
       kill `cat /var/run/apigateway.pid` ;;
     *)
       echo "usage: gatewayscript {start|stop}" ;;
 esac
 exit 0

当我单独运行脚本时,该脚本成功执行。但是monit给了我以下错误:

[Jul 31 18:46:25] error    : 'api-gateway' process is not running
[Jul 31 18:46:25] info     : 'api-gateway' trying to restart
[Jul 31 18:46:25] info     : 'api-gateway' start: '/bin/bash -c /apigateway/gatewayscript start'
[Jul 31 18:46:55] error    : 'api-gateway' failed to start (exit status 0) -- no output

0 个答案:

没有答案