For me now works really good

.
I`ve a suggestion.
When change to 2nd pool, check status of pool 1 every 10 minutes and if its ok, put mining on 1st pool again.
Sometimes have connection problems and miner change pool and no back to pool 1, keep on pool 2.
It is only a good idea if the script can check the connection to Pool 1 without interrupting the mining process, because otherwise if Pool 1 still has connection issues then the script will disconnect from Pool 2 every 10 minutes to check Pool 1 = not very efficient.