SHARE
TWEET

Untitled

a guest Sep 15th, 2016 196 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:8080/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.         /opt/scripta/startup/miner-stop.sh
  18.         sleep 1
  19.         /opt/scripta/startup/miner-start.sh
  20.         prevUrl="$url"
  21.     fi
  22.     sleep 5m
  23. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top