简体   繁体   中英

Restart forever.js for a node.js app through a cron?

My node.js app crashes sometimes and sometimes forever.js automatically restarts it and sometimes it does not.

There's nothing in the logs - I run forever with '-e' option but that doesn't save any error log - my main log simply breaks off and that's it...

Tired of trying to figure it out I wonder if there's another solution: can I set up a cron, which would check my URL for 503 code and if it's the case, it would restart the app using forever?

I know how to white a bash script to start forever but how do I check if the URL returns 503 code?

Thanks!

以这种方式启动您的应用程序:

nohup forever app.js > logs &

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM