How to efficiently manage crypto mining farms

As more and more adopt crypto-currency, more people are finding out about mining for those coins and what a business investment it can be. Unfortunately the technical aspects of doing so can get pretty complex. For that reason we will list a few of our observations, scripts, and methods we use to make farm management reasonable.

First of all as this is already a complex topic we are going to assume that you have decided to make life easy on yourself and as such you are running a farm of at least two EthOS miners on the same local network.

Tools:

  1. http://thecynix.com/rigcontrol.txt (disclosure, I am the author of the rigcontrol script)
  2. A local SSH terminal, could be on an EthOS rig, Ubuntu, Mac, or windows with MobaXterm, cygwin, or ubuntu on windows store.
  3. EthOS miners
  4. Router with MTU setting of 1450 or higher (required for SSH on EthOS)
  5. The password to the user “ethos” (default “live”)

Overview

From either an EthOS or Non EthOS computer on the miners network you want to install and run the rig control script. Once setup it will send the command you gave to all the miners on your config.

Steps

Install:

To install and setup the rig control script run the commands

wget http://thecynix.com/rigcontrol.txt -O ec && chmod +x ec
./ec -s

After running ./ec -s you will be presented with a configuration wizard.
First it will ask you for your EthOS panel, it will use 6 characters from your panel to find all the ip’s in your ethos network (IE: “cynix3” from http://cynix3.ethosdistro.com.) You can leave this blank if you wish to define your own IP range.

If the Panel prompt was left blank the wizard will next ask for your IP class, This is the first 2 or 3 IP octets that do not change between miners (IE: 192.168.1 or 192.168.) then you will be asked for the IP addresses, this is a space separated list (IE: 5 6 12 15 44 122 155 228 229)

Lastly you will be asked for the Password to the user “ethos” on the miners. There is an assumption here that all miners will use the same password. The password will not show as it is typed, this is normal for linux systems.

Your config will now be saved in the same directory you ran the command from as “.ec.conf” This is a plain text file so protect it and this computer.

Remove the plain text config with ./ec -r

Tips: The setup wizard will start if there is no config. So you can run any command to setup the config.
Tips: The configuration filename is based on the name of the command file. The benefit of this is that you can copy or symlink ec to other file names or other directories and each could be a range of miners.

Setup SSH keys by running

./ec -qk

This will start the SSH key wizard. This wizard will automatically create and save a SSH key based on your panel name, so if you have ranges setup in the config it will still ask for a panel. Then the script will send the key to all the miners on the network. That is it, your done with SSH setup. Now is a good time to remove the password from the plain text config file.

TIP: You can run it a second time and if using the same panel you will just be asked if you just want to send the key to the rigs again. Only one will be saved.

NOTE: The SSH keys will be saved to ~/.ssh/ethos-PANELID(.pub). The important thing to take away is that there are two files, one with the .pub or public key and that is what you put on rigs. The file without .pub is your private key and should not be shared or transferred in plain text.

USE

Now the fun part, test with

./ec -c hostname

You should get a list of each rigs hostname. If your more interested in workers test with

./ec -qc ethos-readconf worker

Now check out the help menu

./ec -h

At the time of writing the options are

Usage: ./ec [-r|-s|-k|-h|-q] [-d 1m] [-c “minercommand && minercommand2″] [-f path/to/orgin/file path/to/remote/file]
-r will delete the config (stored in current directory)
-s will start the config wizard and save the config file based on script name
-h will launch this help guide
-k will generate and install ssh keys (~/.ssh/ethos.$panel.pub)
-q will command all miners at once (in subshells)
-d will add delay between commands run (2 seconds is default, can also be #m,#h,and #d)
-c will run any command following it (quote commands that use these symbols: -&<>|*\$()\”)
-f will send a local file to all remote servers (can be dynamic or absolute paths)
Note: you can string arguments and commands like -qkr or -qcecho 0 or -sqf bios.rom folder/modbios.rom

Flags can be separated or stacked, You don’t need a space after a flag but you can. Just about everything from here on out should have the -c or -f flag to send a command or a file. Here are some examples:

./ec -qkr  (quick key install then reset the config so you don't have a plain text pass)
./ec -d 5 -c "tail -1 /var/run/ethos/miner_hashes.file"  (wait 5 seconds before sending the command)
./ec -qc "sed -i '1s#^#https://configmaker.com/my/PutYourConfigLinkHere.txt\n#' remote.conf" (quick remote config install)
./ec -qf RX580.rom .  (quickly send the RX580.rom file to all miners saved in /home/ethos/RX580.rom)
./ec -f ~/Downloads/random-miner.zip /tmp/new-miner.zip  (send random-miner.zip in my downloads directory to the /tmp directory and rename it)
./ec -d0 -c 'i=0;while [ $i -le 5 ]; do sudo atiflash -p $i modded-RX*.rom;((i++));done'  (without delay flash gpu0 - 5 on every miner on the panel)

Okay lets cover that last one a little bit more. -d0 is no delay between sending the command to different rigs. This is different than -q (quick) which runs the same command on all miners at once. It is important not to run the commands that need important logging with -q because the logs get scrambled together and when flashing you want to know exactly which gpu on which rig may have not taken properly before rebooting.

The last command also uses a while loop to flash all GPU’s on the rig. If you have a rig that has multiple GPU’s you would not want to run this loop on them as it would only use 1 bios to flash them all. If each miner has its own modded-RX570.rom or modded-RX470.rom and that rig only has one type of GPUs then it will flash a whole farm of rigs well. Use of commands like this last one could be a desired reason for using IP ranges rather than per panel in the ec.config.

Well as you can see there are a lot of ways to use this script. Any command you can run on the miner you can run through the script giving you a lot more flexibility than paid graphical options. You can run multiple ranges of IP’s, multiple networks, and even multiple panels. Please enjoy this free resource to the community. If you found the script useful to you please consider a donation.

Leave a Reply

Your email address will not be published.