Thursday 18 May 2017

node-forever seems not working and my json config seems wrong

// test.js

var util = require('util');

setTimeout(function () {
    util.puts('Throwing error now.');
    throw new Error('User generated fault.');
}, 200);

$ forever start -l ./forever.log -o output.log -e err.log -m 5 -a start test.js

I run the above command, and get:

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: test_debug.js

I expect to get 5 error log, but actually I just get one in the err.log. It seems test.js just run one time other than 5 times.

I have also tried to use json config to run forever, but it seems not work too. Is there anything wrong?

{
  // config.json
  "append": true,
  "watch": true,
  "MAX": 10,
  "script": "test_debug.js",
  "minUptime": 1000,
  "spinSleepTime": 1000,
//  "sourceDir": "/home/myuser/app",
  "LOGFILE": "forever.log",
  "OUTFILE": "out.log",
  "ERRFILE": "err.log",
  "colors": true
}

I also wonder is there any way to change the -l log path, I tried to use -l ./forever.log, but not work.

Thanks a lot~



via Deng

No comments:

Post a Comment