Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 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 - e.g. the crash or error report, which I usually have if I run the app.js from my console directly.

Do you know how I could make forever restart the app or at least get the errors into the log?

Thank you!

like image 310
Aerodynamika Avatar asked Nov 23 '22 00:11

Aerodynamika


1 Answers

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. Users/{UserName}/.forever on windows.

You should check the ERRFILE. Maybe that will bring some light to why the process failed.

like image 112
adrianvlupu Avatar answered Dec 07 '22 20:12

adrianvlupu