Skip to content

Instantly share code, notes, and snippets.

@darookee
Created June 25, 2017 20:20
Show Gist options
  • Save darookee/fdf8bada82b9dc9b3194d078e38b8096 to your computer and use it in GitHub Desktop.
Save darookee/fdf8bada82b9dc9b3194d078e38b8096 to your computer and use it in GitHub Desktop.
Start mining coins recommended by whattomine
#!/bin/bash
# this script expects scripts named <cointag> in the minerscripts sub directory
# Passing 'i' to this scripts will ask before starting to mine, answer 'n' to quit
# or 'c' to ask for the next available coin
# running without arguments starts mining the first available coin
#
# Example:
#
# cat ./minerscripts/ETH
#
# #!/bin/bash
# ethminer -F http://eth-eu1.nanopool.org:8888/0x01fAA7bDB621693830245bee70D530280EAEF7cE/miningrig -U --cuda-schedule auto
#
# replace the parameters with your configuration
url="https://whattomine.com/coins.json?utf8=%E2%9C%93&eth=true&factor%5Beth_hr%5D=109.0&factor%5Beth_p%5D=420.0&factor%5Bgro_hr%5D=142.0&factor%5Bgro_p%5D=520.0&factor%5Bx11g_hr%5D=46.0&factor%5Bx11g_p%5D=480.0&cn=true&factor%5Bcn_hr%5D=2000.0&factor%5Bcn_p%5D=600.0&eq=true&factor%5Beq_hr%5D=1260.0&factor%5Beq_p%5D=600.0&lre=true&factor%5Blrev2_hr%5D=110000.0&factor%5Blrev2_p%5D=600.0&ns=true&factor%5Bns_hr%5D=2800.0&factor%5Bns_p%5D=600.0&lbry=true&factor%5Blbry_hr%5D=1050.0&factor%5Blbry_p%5D=600.0&factor%5Bbk2b_hr%5D=6400.0&factor%5Bbk2b_p%5D=480.0&factor%5Bbk14_hr%5D=10000.0&factor%5Bbk14_p%5D=500.0&factor%5Bpas_hr%5D=3760.0&factor%5Bpas_p%5D=480.0&bkv=true&factor%5Bbkv_hr%5D=0.0&factor%5Bbkv_p%5D=0.0&factor%5Bcost%5D=0.31&sort=Profitability24&volume=10&revenue=24h&factor%5Bexchanges%5D%5B%5D=&factor%5Bexchanges%5D%5B%5D=bittrex&factor%5Bexchanges%5D%5B%5D=bleutrade&factor%5Bexchanges%5D%5B%5D=btc_e&factor%5Bexchanges%5D%5B%5D=bter&factor%5Bexchanges%5D%5B%5D=c_cex&factor%5Bexchanges%5D%5B%5D=cryptopia&factor%5Bexchanges%5D%5B%5D=poloniex&factor%5Bexchanges%5D%5B%5D=yobit&dataset=Main&commit=Calculate&adapt_q_280x=0&adapt_q_380=0&adapt_q_fury=0&adapt_q_470=0&adapt_q_480=0&adapt_q_750Ti=0&adapt_q_10606=0&adapt_q_1070=4&adapt_q_1080=0"
coins=$(curl -s $url|jq -r '.coins | to_entries[] | .value.tag')
currently_running=$(cat /tmp/currently_mining)
for c in $coins; do
if [ -x "./minerscripts/${c}" ]; then
if [ "${c}" == "${currently_mining}" ]; then
break;
fi
if [ "${1}" == "i" ]; then
read -n 1 -p "Mine ${c}? " continue
if [ "n" == "${continue}" ]; then
echo ""
exit
fi
if [ "c" == "${continue}" ]; then
echo ""
continue
fi
fi
# kill all the miners
pkill -9 ethminer
pkill -9 nheqminer_cuda
pkill -9 ccminer
# set new coin
echo "${c}" > /tmp/currently_mining
# start mining
./minerscripts/${c} > /dev/null
# dont go into background
break
fi
done
echo "Nothing to mine..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment