I have a node app ready which is workable, but has known and unknown bugs which crashes the node app. In such cases it would be nice if pm2 can restart the node app. Is this feature already available in pm2 ?
相关问题
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- google-drive can't get push notifications
- How to reimport module with ES6 import
- Why is `node.js` dying when called from inside pyt
- How to verify laravel passport api token in node /
相关文章
- node连接远程oracle报错
- How can make folder with Firebase Cloud Functions
- @angular-cli install fails with deprecated request
- node.js modify file data stream?
- How to resolve hostname to an ip address in node j
- Transactionally writing files in Node.js
- Log to node console or debug during webpack build
- Get file created date in node
This may help:
More details here
Yes, it does this by default and there is even a watch option to restart on changes.
Also, check new excellent option
pm2 will restart crashed app after 100 msec, then step-by-step increase restart-delay to 15 secunds
To make app restart when it crash you have to use one of PM2 Restart strategies.
There is something called Exponential Backoff Restart Delay which PM2 explains as:
You can set it with CLI by
pm2 start app.js --exp-backoff-restart-delay=100
.There are other restart methods also, which are mentioned here.