Tuesday, 25 April 2017

How to only restart node process with PM2 if exit code != 0

I'm using pm2 to manage a node process. Currently, pm2 restarts the node process even if it finishes cleanly (with exit code 0). I don't want that to happen.

Instead I only want PM2 to restart the app when the node process exits with a code != 0.

How to do this?

The pm2 logs might be useful:

PM2        | App [xxx] with id [0] and pid [44797], exited with code [0] via signal [SIGINT]
PM2        | Starting execution sequence in -fork mode- for app name:xxx id:0
PM2        | App name:xxx id:0 online



via Geert-Jan

No comments:

Post a Comment