diff --git a/lib/blockchain/bitcoin.js b/lib/blockchain/bitcoin.js index b6f9f31b..272b5a55 100644 --- a/lib/blockchain/bitcoin.js +++ b/lib/blockchain/bitcoin.js @@ -18,7 +18,7 @@ function setup (dataDir) { function updateCore (coinRec, isCurrentlyRunning) { common.logger.info('Updating Bitcoin Core. This may take a minute...') - if (isCurrentlyRunning) common.es(`sudo supervisorctl stop bitcoin`) + common.es(`sudo supervisorctl stop bitcoin`) common.es(`curl -#o /tmp/bitcoin.tar.gz ${coinRec.url}`) common.es(`tar -xzf /tmp/bitcoin.tar.gz -C /tmp/`) diff --git a/lib/blockchain/install.js b/lib/blockchain/install.js index 8596d8f9..554e3951 100644 --- a/lib/blockchain/install.js +++ b/lib/blockchain/install.js @@ -71,7 +71,10 @@ function processCryptos (codes) { ) | crontab -` common.es(rsyncCmd) - _.forEach(updateCrypto, selectedCryptos) + _.forEach(c => { + updateCrypto(c) + common.es(`sudo supervisorctl start ${c.code}`) + }, selectedCryptos) logger.info('Installation complete.') } @@ -98,7 +101,9 @@ function setupCrypto (crypto) { function updateCrypto (crypto) { if (!common.isUpdateDependent(crypto.cryptoCode)) return const cryptoPlugin = plugin(crypto) - cryptoPlugin.updateCore(common.getBinaries(crypto.cryptoCode)) + const status = common.es(`sudo supervisorctl status ${crypto.code} | awk '{ print $2 }'`).trim() + const isCurrentlyRunning = status === 'RUNNING' + cryptoPlugin.updateCore(common.getBinaries(crypto.cryptoCode), isCurrentlyRunning) } function plugin (crypto) {