|
|
@ -2,11 +2,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
var nconf = require('nconf'),
|
|
|
|
var nconf = require('nconf'),
|
|
|
|
fs = require('fs'),
|
|
|
|
fs = require('fs'),
|
|
|
|
|
|
|
|
path = require('path'),
|
|
|
|
cluster = require('cluster'),
|
|
|
|
cluster = require('cluster'),
|
|
|
|
async = require('async'),
|
|
|
|
async = require('async'),
|
|
|
|
pidFilePath = __dirname + '/pidfile',
|
|
|
|
pidFilePath = __dirname + '/pidfile',
|
|
|
|
output = fs.openSync(__dirname + '/logs/output.log', 'a'),
|
|
|
|
output = fs.openSync(__dirname + '/logs/output.log', 'a'),
|
|
|
|
numCPUs = 12,// require('os').cpus().length,
|
|
|
|
numCPUs,
|
|
|
|
Loader = {
|
|
|
|
Loader = {
|
|
|
|
timesStarted: 0,
|
|
|
|
timesStarted: 0,
|
|
|
|
shutdown_queue: [],
|
|
|
|
shutdown_queue: [],
|
|
|
@ -16,6 +17,12 @@ var nconf = require('nconf'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nconf.argv().file({
|
|
|
|
|
|
|
|
file: path.join(__dirname, '/config.json')
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
numCPUs = nconf.get('cluster') || require('os').cpus().length;
|
|
|
|
|
|
|
|
|
|
|
|
Loader.init = function() {
|
|
|
|
Loader.init = function() {
|
|
|
|
cluster.setupMaster({
|
|
|
|
cluster.setupMaster({
|
|
|
|
exec: "app.js",
|
|
|
|
exec: "app.js",
|
|
|
@ -150,8 +157,6 @@ Loader.reload = function() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
nconf.argv();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (nconf.get('daemon') !== false) {
|
|
|
|
if (nconf.get('daemon') !== false) {
|
|
|
|
if (fs.existsSync(pidFilePath)) {
|
|
|
|
if (fs.existsSync(pidFilePath)) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|