Created
October 2, 2018 16:20
-
-
Save skwp/4b372f480cfa959107471e30ebb6a6c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn on mining if needed | |
if [[ "$TAG_mining" == "true" ]]; then | |
log "Enabling mining on this node..." | |
if [[ "$TAG_mining_type" == "cpuminer" ]]; then | |
bitcoinExec getnewaddress | |
docker run -d --name miner wernight/cpuminer-multi:alpine cpuminer -a sha256d -o http://$DOCKER_HOST_ADDRESS:9332 -O $TAG_rpcuser:$TAG_rpcpassword --coinbase-addr=$bitcoinExecResult --no-longpoll --no-stratum --no-extranonce --no-getwork | |
else | |
mining_rpc_call="setgenerate true $TAG_mining_cores" | |
mining_command="docker exec bitcoin /usr/local/bin/bitcoin-cli -rpcuser=$TAG_rpcuser -rpcpassword=$TAG_rpcpassword $mining_rpc_call" | |
# Turn on mining now | |
$($mining_command) | |
# Turn on mining every min in case we crash | |
echo "*/1 * * * * $mining_command" > miningOn.cron; crontab miningOn.cron | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment