Guest User

Untitled

a guest
Sep 18th, 2016
122
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. sleep 10
  4.  
  5. prevUrl=-1
  6. url=0
  7.  
  8. # enter main loop
  9. while true; do
  10.     result=`curl --fail --silent -X POST -H "Content-Type: application/json" -d '{"algos": {"x11": {"hashrate": 150000000},"x13": {"hashrate": 150000000},"x14": {"hashrate": 150000000},"x15": {"hashrate": 150000000},"quark": {"hashrate":150000000},"qubit": {"hashrate":150000000}}, "region": "eu", "name": "A01"}' 'http://10.1.0.49:8081/api/query' | jq '.result'`
  11.     algo=`echo $result | jq -r '.algo'`
  12.     url=`echo $result | jq -r '.url'`
  13.     if [ "$url" != "" ] && [ "$url" != "$prevUrl" ]; then
  14.         # new algo, change conf and restart miner
  15.         echo "switching to $algo"
  16.         curl -X GET -H "Content-Type: application/json" -G -i -d 'pools=[{"url":"'"$url"'","pass":"x","priority":"10","algo":"'"$algo"'","user":"12gotm1HbU1zv9FMnuNfPakpn7rsRjB1no.A01"}]' "http://localhost/f_settings.php"
  17.         prevUrl="$url"
  18.     fi
  19.     sleep 5m
  20. done
RAW Paste Data