|
@ -1,3 +1,5 @@ |
|
|
|
|
|
const spawn = require('child_process').spawn; |
|
|
|
|
|
|
|
|
module.exports = (shepherd) => { |
|
|
module.exports = (shepherd) => { |
|
|
const getConf = (flock, coind) => { |
|
|
const getConf = (flock, coind) => { |
|
|
let DaemonConfPath = ''; |
|
|
let DaemonConfPath = ''; |
|
@ -135,7 +137,8 @@ module.exports = (shepherd) => { |
|
|
// check if komodod instance is already running
|
|
|
// check if komodod instance is already running
|
|
|
shepherd.portscanner.checkPortStatus(_port, '127.0.0.1', (error, status) => { |
|
|
shepherd.portscanner.checkPortStatus(_port, '127.0.0.1', (error, status) => { |
|
|
// Status is 'open' if currently in use or 'closed' if available
|
|
|
// Status is 'open' if currently in use or 'closed' if available
|
|
|
if (status === 'closed') { |
|
|
if (status === 'closed' || |
|
|
|
|
|
!shepherd.appConfig.stopNativeDaemonsOnQuit) { |
|
|
// start komodod via exec
|
|
|
// start komodod via exec
|
|
|
const _customParamDict = { |
|
|
const _customParamDict = { |
|
|
silent: '&', |
|
|
silent: '&', |
|
@ -169,6 +172,13 @@ module.exports = (shepherd) => { |
|
|
if (!shepherd.kmdMainPassiveMode) { |
|
|
if (!shepherd.kmdMainPassiveMode) { |
|
|
let _arg = `${coindACParam}${data.ac_options.join(' ')}${_customParam}`; |
|
|
let _arg = `${coindACParam}${data.ac_options.join(' ')}${_customParam}`; |
|
|
_arg = _arg.trim().split(' '); |
|
|
_arg = _arg.trim().split(' '); |
|
|
|
|
|
|
|
|
|
|
|
if (!shepherd.appConfig.stopNativeDaemonsOnQuit) { |
|
|
|
|
|
spawn(shepherd.komododBin, _arg, { |
|
|
|
|
|
stdio: 'ignore', // piping all stdio to /dev/null
|
|
|
|
|
|
detached: true, |
|
|
|
|
|
}).unref(); |
|
|
|
|
|
} else { |
|
|
shepherd.execFile(`${shepherd.komododBin}`, _arg, { |
|
|
shepherd.execFile(`${shepherd.komododBin}`, _arg, { |
|
|
maxBuffer: 1024 * 1000000 // 1000 mb
|
|
|
maxBuffer: 1024 * 1000000 // 1000 mb
|
|
|
}, (error, stdout, stderr) => { |
|
|
}, (error, stdout, stderr) => { |
|
@ -189,6 +199,7 @@ module.exports = (shepherd) => { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if (shepherd.kmdMainPassiveMode) { |
|
|
if (shepherd.kmdMainPassiveMode) { |
|
|
shepherd.coindInstanceRegistry[data.ac_name] = true; |
|
|
shepherd.coindInstanceRegistry[data.ac_name] = true; |
|
@ -731,7 +742,8 @@ module.exports = (shepherd) => { |
|
|
|
|
|
|
|
|
shepherd.portscanner.checkPortStatus(_port, '127.0.0.1', (error, status) => { |
|
|
shepherd.portscanner.checkPortStatus(_port, '127.0.0.1', (error, status) => { |
|
|
// Status is 'open' if currently in use or 'closed' if available
|
|
|
// Status is 'open' if currently in use or 'closed' if available
|
|
|
if (status === 'open') { |
|
|
if (status === 'open' && |
|
|
|
|
|
shepherd.appConfig.stopNativeDaemonsOnQuit) { |
|
|
if (!skipError) { |
|
|
if (!skipError) { |
|
|
shepherd.log(`komodod service start error at port ${_port}, reason: port is closed`); |
|
|
shepherd.log(`komodod service start error at port ${_port}, reason: port is closed`); |
|
|
shepherd.writeLog(`komodod service start error at port ${_port}, reason: port is closed`); |
|
|
shepherd.writeLog(`komodod service start error at port ${_port}, reason: port is closed`); |
|
|