|
@ -2496,16 +2496,16 @@ function setConf(flock) { |
|
|
return new Promise(function(resolve, reject) { |
|
|
return new Promise(function(resolve, reject) { |
|
|
const result = 'Check Conf file exists is done' |
|
|
const result = 'Check Conf file exists is done' |
|
|
|
|
|
|
|
|
fs.ensureFile(DaemonConfPath, function(err) { |
|
|
const confFileExist = fs.ensureFileSync(DaemonConfPath); |
|
|
shepherd.log(err); // => null
|
|
|
if (confFileExist) { |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
|
|
|
shepherd.log(result); |
|
|
shepherd.log(result); |
|
|
shepherd.writeLog(`setconf ${result}`); |
|
|
shepherd.writeLog(`setconf ${result}`); |
|
|
|
|
|
|
|
|
resolve(result); |
|
|
resolve(result); |
|
|
}, 2000); |
|
|
} else { |
|
|
|
|
|
shepherd.log('conf file doesnt exist'); |
|
|
|
|
|
resolve('conf file doesnt exist'); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2514,13 +2514,10 @@ function setConf(flock) { |
|
|
const result = 'Conf file permissions updated to Read/Write'; |
|
|
const result = 'Conf file permissions updated to Read/Write'; |
|
|
|
|
|
|
|
|
fsnode.chmodSync(DaemonConfPath, '0666'); |
|
|
fsnode.chmodSync(DaemonConfPath, '0666'); |
|
|
|
|
|
shepherd.log(result); |
|
|
|
|
|
shepherd.writeLog(`setconf ${result}`); |
|
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
resolve(result); |
|
|
shepherd.log(result); |
|
|
|
|
|
shepherd.writeLog(`setconf ${result}`); |
|
|
|
|
|
|
|
|
|
|
|
resolve(result); |
|
|
|
|
|
}, 1000); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2539,16 +2536,13 @@ function setConf(flock) { |
|
|
fs.writeFile(DaemonConfPath, rmlines, 'utf8', function(err) { |
|
|
fs.writeFile(DaemonConfPath, rmlines, 'utf8', function(err) { |
|
|
if (err) |
|
|
if (err) |
|
|
return shepherd.log(err); |
|
|
return shepherd.log(err); |
|
|
|
|
|
|
|
|
|
|
|
fsnode.chmodSync(DaemonConfPath, '0666'); |
|
|
|
|
|
shepherd.writeLog(`setconf ${result}`); |
|
|
|
|
|
shepherd.log(result); |
|
|
|
|
|
resolve(result); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
fsnode.chmodSync(DaemonConfPath, '0666'); |
|
|
|
|
|
setTimeout(function() { |
|
|
|
|
|
shepherd.writeLog(`setconf ${result}`); |
|
|
|
|
|
shepherd.log(result); |
|
|
|
|
|
|
|
|
|
|
|
resolve(result); |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2565,7 +2559,7 @@ function setConf(flock) { |
|
|
shepherd.log('rpcuser: OK'); |
|
|
shepherd.log('rpcuser: OK'); |
|
|
shepherd.writeLog('rpcuser: OK'); |
|
|
shepherd.writeLog('rpcuser: OK'); |
|
|
} else { |
|
|
} else { |
|
|
const randomstring = md5(Math.random() * Math.random() * 999); |
|
|
const randomstring = md5((Math.random() * Math.random() * 999).toString()); |
|
|
|
|
|
|
|
|
shepherd.log('rpcuser: NOT FOUND'); |
|
|
shepherd.log('rpcuser: NOT FOUND'); |
|
|
shepherd.writeLog('rpcuser: NOT FOUND'); |
|
|
shepherd.writeLog('rpcuser: NOT FOUND'); |
|
@ -2593,7 +2587,7 @@ function setConf(flock) { |
|
|
shepherd.log('rpcpassword: OK'); |
|
|
shepherd.log('rpcpassword: OK'); |
|
|
shepherd.writeLog('rpcpassword: OK'); |
|
|
shepherd.writeLog('rpcpassword: OK'); |
|
|
} else { |
|
|
} else { |
|
|
var randomstring = md5(Math.random() * Math.random() * 999); |
|
|
var randomstring = md5((Math.random() * Math.random() * 999).toString()); |
|
|
|
|
|
|
|
|
shepherd.log('rpcpassword: NOT FOUND'); |
|
|
shepherd.log('rpcpassword: NOT FOUND'); |
|
|
shepherd.writeLog('rpcpassword: NOT FOUND'); |
|
|
shepherd.writeLog('rpcpassword: NOT FOUND'); |
|
@ -2705,27 +2699,10 @@ function setConf(flock) { |
|
|
.then(addnode); |
|
|
.then(addnode); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
shepherd.log(result); |
|
|
shepherd.log(result); |
|
|
shepherd.writeLog(`checkconf addnode ${result}`); |
|
|
shepherd.writeLog(`checkconf addnode ${result}`); |
|
|
|
|
|
|
|
|
|
|
|
resolve(result); |
|
|
|
|
|
}, 2000); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const MakeConfReadOnly = function() { |
|
|
resolve(result); |
|
|
return new Promise(function(resolve, reject) { |
|
|
|
|
|
const result = 'Conf file permissions updated to Read Only'; |
|
|
|
|
|
|
|
|
|
|
|
fsnode.chmodSync(DaemonConfPath, '0400'); |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function() { |
|
|
|
|
|
shepherd.log(result); |
|
|
|
|
|
shepherd.writeLog(`MakeConfReadOnly ${result}`); |
|
|
|
|
|
|
|
|
|
|
|
resolve(result); |
|
|
|
|
|
}, 1000); |
|
|
|
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|