Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
678 views
in Technique[技术] by (71.8m points)

linux - Monit -failed to start (exit status 1) -- no output

I need to start pm2 apps using monit. Im not able to restart it or exec a script which sends messages to slack channel. Can some one help.

On monit logs it says trying to restart, but it gives

[UTC Jan  6 10:19:01] error   :  'server' failed to start (exit status 1) -- no output

My monit config is this


check process server with pidfile /home/otheruser/.pm2/pids/server-0.pid
  start program = "/home/otheruser/.nvm/versions/node/v5.2.0/bin/pm2 start 0" as uid "otheruser" and gid "otheruser"
  stop program = "/home/otheruser/.nvm/versions/node/v5.2.0/bin/pm2 stop 0" as "otheruser" and gid "otheruser"
if failed host 127.0.0.1 port 3002 then restart
if failed host 127.0.0.1 port 3002 then exec "/etc/monit/slack_notifications.sh"
if failed host 127.0.0.1 port 3002 for 2 cycles then exec "/etc/monit/slack_notifications.sh" else if succeeded then exec "/etc/monit/slack_notifications.sh"

#only this line works, above lines are not working
if 5 restarts within 5 cycles then exec "/etc/monit/slack_notifications.sh"

Only otheruser can run pm2 commands here.

Dont know why this is not working as well as the failed host check is not triggering the shell file.

This is the shell file

#!/bin/sh
/usr/bin/curl 
    -X POST 
    -s 
    --data-urlencode "payload={ 
        "channel": "my-channel", 
        "username": "Monit", 
        "pretext": "servername | $MONIT_DATE", 
        "color": "danger", 
        "icon_emoji": ":ghost:", 
        "text": "$MONIT_SERVICE - $MONIT_DESCRIPTION" 
    }" 
    my slack webhook


    ```

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...