美文网首页
PM2检查进程状态并重启

PM2检查进程状态并重启

作者: 泽赫 | 来源:发表于2020-09-24 11:10 被阅读0次

    pm2 delete <name>
    pm2 start <name>
    pm2 stop <name>
    pm2 restart <name>

    主要针对delete错误或者stop错误,不往后执行的问题

    最优解决方案

    # The || : part executes if the pm2 delete sets a non-zero return code
    # (which happens when try to delete an app that does not exist yet).
    # The : is a null operator that returns 0 success exit code. So whatever happens, the pm2 start line is executed.
    pm2 delete -s 'celerpay-official-site' || :
    pm2 start npm --name 'celerpay-official-site' -- run start"$0"
    

    相关文章

      网友评论

          本文标题:PM2检查进程状态并重启

          本文链接:https://www.haomeiwen.com/subject/ovszyktx.html