-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.js
40 lines (31 loc) · 1.14 KB
/
start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var $ = require("jquery");
var config = require('./config');
var forever = require('forever-monitor');
//Configure Forever
var child = new (forever.Monitor)(__dirname + '/server.js', {
uid: config.forever.uid,
max: config.forever.max_failures,
silent: config.forever.silent,
spinSleepTime: 10,
watch: (config.general.production) ? false : config.forever.watch,
watchDirectory: __dirname + "/" + config.forever.watch_directory,
watchIgnoreDotFiles: config.forever.watch_ignore_dot,
watchIgnorePatterns: $.map(config.forever.watch_ignore_patterns, function(value) {
return __dirname + "/" + value;
}),
env: {
'NODE_ENV': (config.general.production) ? "production" : "development"
},
outFile: __dirname + "/" + config.forever.output_log,
errFile: __dirname + "/" + config.forever.error_log,
killTree: true
});
child.on('exit', function () {
console.log("server.js fully down after " + config.forever.max_failures + " starts.");
console.log("SERVER DOWN.");
});
child.on('exit:code', function(code) {
console.log("server.js exited with code " + code);
});
//Start Forver
child.start();