Bitcoin Forum
November 06, 2024, 02:11:04 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: a much simpler failover system and hung miner solution  (Read 1764 times)
electrocutey (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
July 10, 2011, 06:39:25 PM
 #1

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

Quote
from time import time
import platform

add "import signal" on the next line after "import platform"

next search for the word "starting" and you will find

Quote
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

Quote
import sys

Add a line after that that says "import signal", and then search for a line that looks like

Quote
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.

Quote
#!/bin/bash
while :; do
  for i in `cat ~/miner1.login` ; do
    cd ~/phoenix
    ./phoenix.py -u $i -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false -a 7
  done
done


miner1.login can look like this

Quote

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)

mQENBE4Z3QEBCADeDzmT+ihL+GDsBsn9X3/hg/UGiqtARNjZhvUewOLa+Z1RQnRx
A8JqzbqIGfd2Qb+cXvuoDYKykNP+IsepA/BTem3PC/RUAbCXnFzKiyFnWr6kIkKj
2wF1fcS9VLbvhKVBmgW+H16YiqQ0TvOhNt9KM3ZWNCbPBko/9AAhWBYrXgbHoecO
gefbd+2XmLibj42R00ruGDAqUJT/UdLtMBgH9bQ5RZZRJPqIKD8gvFKDvU3ag8/T
lV2pazT2w1NjQLiRIlhrNMlxw2Jrw2UJcxm60VqkbHoAhYaBd0VlkXfyRCz4+7hJ
Qj6IxrSXT+TSaofrl+6UmwP+voNSr8ZcL4urABEBAAG0IWVsZWN0cm9jdXRleSBv
biBmb3J1bS5iaXRjb2luLm9yZ4kBOAQTAQIAIgUCThndAQIbAwYLCQgHAwIGFQgC
CQoLBBYCAwECHgECF4AACgkQOY7gEfw+gniNSAgAlgezqdwVFpdzBO60RPmZiTd4
ZtBS0is/MvBTjmFv8WkEJiEwkpZRYRIVnOstdma352l5OELsjNzoF+VzULQ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 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!