I'm trying to setup forever
and NodeJS
to monitor&restart my app and also keep it running when exits. Currently I have this:
var forever = require("forever-monitor");
var child = new(forever.Monitor)('main.js', {
'silent': false,
'pidFile': '../pids/app.pid',
'sourceDir': '.',
'watch': true,
'watchDirectory': '.',
'watchIgnoreDotFiles': null,
'watchIgnorePatterns': null,
'logFile': '../logs/forever.log',
'outFile': '../logs/forever.out',
'errFile': '../logs/forever.err'
});
child.start();
Which starts my app just fine but it doesn't restart it when I make changes in the file. Is there some option that I'm missing?
EDIT: After digging into the problem I found that the file change is detected actually, it's just that the process isn't restarted. I'm looking at line ~317 - Monitor.prototype.kill (in monitor.js) but everything looks like it should work.
EDIT: I managed to fix the issue. It's a bug in the library's code. Check here: https://github.com/nodejitsu/forever-monitor/issues/27