Giter Site home page Giter Site logo

bitcoin-miner-script's Introduction

This is a script that manages your bitcoin miners.

This will start phoenix in a detached screen session, the screen sesion name is set to the MINER_ID-Miner as specified in the settings.

For phoenix miner to work in a detached screen session, you should edit your ~/.screenrc and set the appropriate environment variables, I have the following in my ~/.screenrc

setenv LD_LIBRARY_PATH "/opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/:/opt/ati-stream-sdk-v2.1-lnx64/lib/x86_64/"
setenv DISPLAY ":0"

--

Logic/Thinking:

This script uses a file hosted on your web server to figure out where to "point" your miner to. It also checks to make sure that the Temperature of your GPU is under a set limit and that the LOAD on your GPU is above a specified threshold.

IT requires that you have wget and sendemail installed. To install both of these packages, issue a apt-get install wget sendemail  

* please notice that its sendEmail, not sendMail


Here's what it does, run in a infinite while loop:

0) Kill any old instances of the miners that may be running (Cleanup) and start the while loop from #1 below
1) Fetch your control url
2) If #1 fails, sleep and repeat the main while loop
3) Check if miner is running, if not, start it using the address from step #1 above
4) Check if the address currently in use is different from #1 
5) if so, kill the currently running miner (when we loop next time, we start with new address)
6) If address has not changed, check if Temp is under limit, if Temp > Threshold, kill miner
7) Check Load, if load is under threshold, sleep 15 seconds
8) Check Load again, if load is under threshold, kill miner, (When loop repeats, it will start miner)

The recheck period is 10 seconds, and we recheck only under these conditions:

* If miner wasn't running and we just restarted it
* If the miner was killed because load was under specified threshhold

Aside from those two conditions, the loop repeats in 300 seconds (5 minutes)


Configuration:

The configuration settings are at the top of the script, here is a bit more detailed description of everything

CTRL_URL - this needs to point to something that returns a phoenix-friendly URL

MINER_ID - this is an idintification string to differentiate different screen sessions for people that have multiple GPU's in one system
ATICONFIG_ADAPTER_ID - this should contain an integer as you would specifiy for --adapter=X when running aticonfig for checking Temperature and Load

PHOENIX_OPTIONS - this is an entire string of commands that you pass to the phoenix miner

MIN_LOAD - if the load on the GPU drop below this limit, we'll kill the miner
MAX_TEMP - if the temp reported by aticonfig goes above this limit, we'll kill the miner

ENABLE_EMAIL - set this to 1 if you want to recieve spam/email alerts from your miner

# some basic email settings
FROM="[email protected]";
TO="[email protected]";
SMTP_SERVER="10.1.0.58:25";

# Logging
ENABLE_LOG=1;  # 1=enabled, anything else will disable it
LOG="/tmp/Log-$MINER_ID.log"

bitcoin-miner-script's People

Contributors

jsidhu avatar twixt01 avatar

Stargazers

 avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

frazile-devs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.