[英]Forever.js doesn't restart my Node.js / Express app
I'm using forever.js
to make sure my Node.js / Express app runs without a break. 我正在使用
forever.js
来确保我的Node.js / Express应用程序不间断运行。 However, sometimes it crashes and forever doesn't restart it. 但是,有时它崩溃并永远不会重新启动它。
I'm using 我正在使用
forever start app.js
to start the app 启动应用程序
and it starts fine, works, and then at some point crashes and when I do 它开始很好,工作,然后在某些时候崩溃,当我这样做
forever list
it doesn't list anything, so it simply doesn't restart... 它没有列出任何东西,所以它根本不重启...
I also tried running it with a log file, using 我还尝试使用日志文件运行它
forever start -l foreverlog.txt app.js
and the log file is fine, but it doesn't show any info about the end of the process - eg the crash or error report, which I usually have if I run the app.js
from my console directly. 并且日志文件很好,但它没有显示有关进程结束的任何信息 - 例如崩溃或错误报告,如果我直接从我的控制台运行
app.js
,我通常app.js
。
Do you know how I could make forever restart the app or at least get the errors into the log? 你知道如何永远重启应用程序或者至少把错误记录到日志中吗?
Thank you! 谢谢!
Forever splits the log 永远拆分日志
-l LOGFILE Logs the forever output to LOGFILE
-o OUTFILE Logs stdout from child script to OUTFILE
-e ERRFILE Logs stderr from child script to ERRFILE
Even if you didn't specify the -e file it should be somewhere. 即使你没有指定-e文件,它应该在某个地方。 Users/{UserName}/.forever on windows.
用户/ {UserName} /。永远在Windows上。
You should check the ERRFILE. 你应该检查ERRFILE。 Maybe that will bring some light to why the process failed.
也许这会为这个过程失败的原因带来一些启示。
You need to use spinSleepTime: 你需要使用spinSleepTime:
forever --minUptime 1000 --spinSleepTime 1000 -w -l *.log -e *.log --port 1234 app.js
--minUptime not set. --minUptime未设置。 Defaulting to: 1000ms
默认为:1000ms
--spinSleepTime not set. --spinSleepTime未设置。 Your script will exit if it does not stay up for at least 1000ms
如果脚本不能保持至少1000毫秒,您的脚本将退出
Try killing the process manually by searching for the process with 尝试通过搜索进程手动终止进程
ps axl | grep node
then 然后
kill 24597
replace 24597 with your process number. 用您的过程编号替换24597。 Then reboot forever again.
然后再次重启。
http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever/ http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.