refactor: supervisor config pull up method
fix: small fixes
This commit is contained in:
parent
c0808e9bd7
commit
048971fdb3
2 changed files with 29 additions and 28 deletions
|
|
@ -76,33 +76,28 @@ function es (cmd) {
|
|||
return res.toString()
|
||||
}
|
||||
|
||||
function generateSupervisorConfig (cryptoCode, command, isWallet = false) {
|
||||
return `[program:${cryptoCode}${isWallet ? `-wallet` : ``}]
|
||||
command=nice ${command}
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stderr_logfile=/var/log/supervisor/${cryptoCode}${isWallet ? `-wallet` : ``}.err.log
|
||||
stdout_logfile=/var/log/supervisor/${cryptoCode}${isWallet ? `-wallet` : ``}.out.log
|
||||
environment=HOME="/root"
|
||||
`
|
||||
}
|
||||
|
||||
function writeSupervisorConfig (coinRec, cmd, walletCmd = '') {
|
||||
if (isInstalledSoftware(coinRec)) return
|
||||
|
||||
const blockchain = coinRec.code
|
||||
|
||||
if (!_.isNil(coinRec.wallet)) {
|
||||
const supervisorConfigWallet = `[program:${blockchain}-wallet]
|
||||
command=nice ${walletCmd}
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stderr_logfile=/var/log/supervisor/${blockchain}-wallet.err.log
|
||||
stdout_logfile=/var/log/supervisor/${blockchain}-wallet.out.log
|
||||
environment=HOME="/root"
|
||||
`
|
||||
|
||||
const supervisorConfigWallet = generateSupervisorConfig(blockchain, walletCmd, true)
|
||||
writeFile(`/etc/supervisor/conf.d/${coinRec.code}-wallet.conf`, supervisorConfigWallet)
|
||||
}
|
||||
|
||||
const supervisorConfig = `[program:${blockchain}]
|
||||
command=nice ${cmd}
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stderr_logfile=/var/log/supervisor/${blockchain}.err.log
|
||||
stdout_logfile=/var/log/supervisor/${blockchain}.out.log
|
||||
environment=HOME="/root"
|
||||
`
|
||||
|
||||
const supervisorConfig = generateSupervisorConfig(blockchain, cmd)
|
||||
writeFile(`/etc/supervisor/conf.d/${coinRec.code}.conf`, supervisorConfig)
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +120,7 @@ function fetchAndInstall (coinRec) {
|
|||
const binDir = requiresUpdate ? binaries.defaultDir : binaries.dir
|
||||
|
||||
es(`wget -q ${url}`)
|
||||
coinRec.cryptoCode === 'XMR'
|
||||
es(`echo ${downloadFile} | awk -F. '{print $NF}'`) === 'bz2'
|
||||
? es(`tar -xf ${downloadFile}`)
|
||||
: es(`tar -xzf ${downloadFile}`)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue