auto-fallback

This commit is contained in:
Tjatse 2015-12-17 19:04:02 +08:00
parent 35cbe1515d
commit 59e000249d
2 changed files with 15 additions and 11 deletions

View File

@ -71,10 +71,20 @@ Monitor.prototype._init = function (options) {
} catch (err) {
console.error('Can not load PM2 config, the file "' + pm2ConfPath + '" does not exist.');
options.pm2Conf = {
DAEMON_RPC_PORT: defConf.pm2.rpc,
DAEMON_PUB_PORT: defConf.pm2.pub,
INTERACTOR_RPC_PORT: defConf.pm2.interactor_rpc
DAEMON_RPC_PORT: path.resolve(options.pm2, 'rpc.sock'),
DAEMON_PUB_PORT: path.resolve(options.pm2, 'pub.sock'),
PM2_LOG_FILE_PATH: path.resolve(options.pm2, 'pm2.log')
};
if (!fs.existsSync(options.pm2Conf.DAEMON_RPC_PORT)) {
throw new Error(fbMsg + ' But file ' + options.pm2Conf.DAEMON_RPC_PORT + ' can not found.');
}
if (!fs.existsSync(options.pm2Conf.DAEMON_PUB_PORT)) {
throw new Error(fbMsg + ' But file ' + options.pm2Conf.DAEMON_PUB_PORT + ' can not found.');
}
if (!fs.existsSync(options.pm2Conf.PM2_LOG_FILE_PATH)) {
throw new Error(fbMsg + ' But file ' + options.pm2Conf.PM2_LOG_FILE_PATH + ' can not found.');
}
}
// Bind socket.io server to context.

View File

@ -1,10 +1,4 @@
refresh = 5000
pm2 = ~/.pm2
debug = true
port = 8088
; Overidde PM2 configuration if defined
[pm2]
home = ~/.pm2
;rpc = ~/.pm2/rpc.sock
;pub = ~/.pm2/pub.sock
;interactor_rpc = ~/.pm2/interactor.sock