This fixes it. This one is for the stratum server on my cubes same thing will work on a regular cgminer screen session as well.
Php to poll the site:
$url="https://www.multipool.us/";
$ch = curl_init();
$header=array(
);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_COOKIEFILE,'cookies.txt');
curl_setopt($ch,CURLOPT_COOKIEJAR,'cookies.txt');
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result=curl_exec($ch);
print '
';
print_r($result);
curl_close($ch);
?>
Then a bash script:
while :
do
#Pull multipool.us current coin
php mp.php > test
#process coin being mined
NEW=`grep -A 10 sha-256 test| grep -A 1 currently| sed '1d'|sed -e :a -e 's/<[^>]*>//g;/
#error check current
if [[ -z "$CUR" ]]; then
CUR="btc"
fi
#error check new
if [[ -z "$NEW" ]]; then
NEW="btc"
fi
if [ "$NEW" == "ppc" ]; then
NEW="btc"
fi
if-z-var-e-var
if [ "$NEW" != "$CUR" ] && [ "$NEW" == "btc" ]; then
screen -S proxy -p 0 -X quit
screen -dmS proxy /home/miner/stratum-mining-proxy/mining_proxy.py -o us1.ghash.io -p 3333
else
if [ "$NEW" != "$CUR" ] && [ "$NEW" != "btc" ]; then
screen -S proxy -p 0 -X quit
screen -dmS proxy /home/miner/stratum-mining-proxy/mining_proxy.py -o pool1.us.multipool.us -p 8888
fi
fi
sleep 600
done