I am pretty new to bitcoin, and one of the first things I noticed is that pools keep getting DDoSed, causing my miners to go idle. I looked around at how people are solving this, and the solutions always seem too complicated. I have to install apache, php, and mysql just to keep my miners from going idle? That isn't necessarily too hard for me, I just didn't think it needed to be so complicated.
So the first problem is, how do you detect when a miner is having problems? Let's start with the assumption that it will have problems. These instructions are for phoenix, but can be easily modified for any miner. Open Miner.py in a text editor. At the beginning of the file right after the comments you will see
from time import time
add "import signal" on the next line after "import platform"
next search for the word "starting" and you will find
self.logger.log("Phoenix %s starting..." % self.VERSION)
on the next line, add "signal.alarm(300)"
Now your phoenix miner is set to close itself in 5 minutes no matter what, starting the countdown as soon as it prints the "starting" message. Save changes, and then start editing "ConsoleLogger.py". Once again, in the beginning of the file you will see a line that says
Add a line after that that says "import signal", and then search for a line that looks like
self.accepted += 1
And add a line after that that says "signal.alarm(300)"
Now phoenix is set to reset the countdown to its own demise to 5 minutes again every time it completes one share. As long as your GPU can solve them in less than 5 minutes, this will work perfectly. If a pool goes down for more than 5 minutes, phoenix will close. If phoenix itself locks up on you, within 5 minutes it will close.
Of course a miner that shuts down does you no good, so you will have to run it in a loop. And when you start it back up, you should try another server. Here is miner1.sh, or maybe miner0.sh would be a better name for it. Whatever you decide to call it is fine. It runs in a loop, telling phoenix to connect to each server in miner1.login, one after another.
while :; do
for i in `cat ~/miner1.login` ; do
./phoenix.py -u $i -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false -a 7
miner1.login can look like this
You can edit miner1.login at any time. As soon as a loop completes, miner1.sh will read miner1.login in again and start fresh. And there you have it. A very simple failover system that requires nothing more than a shell script and 4 lines of changes to phoenix.
If you want to improve it, it is very simple. Say you see a miner repeatedly trying to connect to a pool that is down, and it says "Failed to connect, retrying..." on your screen. Just open up ConsoleLogger.py, find the line that prints that, and add "signal.alarm(1)" after it. Now it won't waste time reconnecting to servers with problems, and will instead move on to another one quickly.
If you have more than one GPU, copy miner1.sh to miner2.sh and make the changes you need for it (DEVICE=, and possibly other things). If you want to use different logins for different miners, copy miner1.login to miner2.login and change the usernames and passwords, and tell miner2.sh to look in miner2.login.
If you are mining in Windows, you should be able to make a batch file with a GOTO loop.
If you find this useful, please donate to 18dUs6P43Xsrm4xtgg2z16jDFqAmPD9sKh
If you repost this somewhere else, please repost the entire thing including my donation address.
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
-----END PGP PUBLIC KEY BLOCK-----