简体   繁体   English

通过cron重新启动node.js应用程序的forever.js吗?

[英]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. 我的node.js应用有时会崩溃,有时会永远崩溃。js会自动将其重启,而有时不会。

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... 日志中没有任何内容-我使用'-e'选项永久运行,但不会保存任何错误日志-我的主日志完全中断,仅此而已...

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? 厌倦了尝试找出答案,我想知道是否还有其他解决方案:我可以设置cron来检查我的503代码的URL,如果是这种情况,它将永久使用该应用程序重新启动?

I know how to white a bash script to start forever but how do I check if the URL returns 503 code? 我知道如何给bash脚本加白以使其永久启动,但是如何检查URL是否返回503代码?

Thanks! 谢谢!

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

nohup forever app.js > logs &

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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