PM2检查进程状态并重启
2020-09-24 本文已影响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"