ethOS – auto-reboot scripts

Tested on ethOS versions: 1.2.9, 1.3.0, 1.3.1


When we are investing in cryptocurrency mining rigs we expect return as passive incomes. In other words – “Invest and forget”. Unfortunately, we are always looking into the dashboard in case of GPU mining crash. If we found such situation – we are just rebooting the rig and “waiting” for a new crash in the future.

In perfect world we would configured (and overclocked our GPU) the rig precisely and there would be no similar situations. But… What we can do to prevent any crash in a real world? Solution is to configure the scheduled jobs (cronjobs) which checks system and GPU statuses. If something fails – automatically restart the system.

Restart on mining speed decrease

One of the most important things is to respond as soon as possible to speed decrease. Usually it means, that one of the GPU is crashed and do not mine for you. Ineffective time is payless. You should go follow the instructions and these situations will take a short time.

“Check and reboot” script

Copy the scriprt and save to a “” in your ethOS home directory (the same directory, where your local.conf and remote.conf exists):

TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")
GPU_SPEEDS_RAW=$(php /opt/ethos/lib/ethos-stats-dump.php | grep -P "miner_hashes:")
GPU_SPEEDS_STRING=$(cut -d ":" -f 2 <<< "$GPU_SPEEDS_RAW")
GPU_SPEEDS=' ' read -r -a array <<< $GPU_SPEEDS_STRING
if (( "$REQ_GPU_COUNT" > "$GPU_COUNT" ));
        echo "${TIMESTAMP}: Required GPU: $REQ_GPU_COUNT, Accutal GPU: $GPU_COUNT" | tee -a ${LOG_FILE}
        if [ ${RESTART_ON_ERROR} = TRUE ];
                echo "{$TIMESTAMP} Rebooting..." | tee -a ${LOG_FILE}
                /usr/bin/sudo /opt/ethos/bin/r
                exit 9
        echo "${TIMESTAMP}: OK: Required GPU: $REQ_GPU_COUNT, Accutal GPU: $GPU_COUNT" | tee -a ${LOG_FILE}
for i in "${!GPU_SPEEDS[@]}"
        GPU_SPEED=$(printf "%.*f\n" 0 ${GPU_SPEEDS[i]})
        if (( "$GPU_SPEED" > "$MIN_GPU_SPEED" ));
                echo "${TIMESTAMP}: OK: GPU$i speed: $GPU_SPEED, minimum required: $MIN_GPU_SPEED" | tee -a ${LOG_FILE}
                echo "${TIMESTAMP}: GPU$i speed: $GPU_SPEED, minimum required: $MIN_GPU_SPEED" | tee -a ${LOG_FILE}
                if [ ${RESTART_ON_ERROR} = TRUE ];
                echo "{$TIMESTAMP} Rebooting..." | tee -a ${LOG_FILE}
                /usr/bin/sudo /opt/ethos/bin/r
                exit 9

This code is checking two things – if the working GPU count and mining speed of each of it is not less than preconfigured. Configured values will be setup in the next step.

Cronjob every 15 minutes

In ethOS we will configure cronjob for every 15 minutes to check if everything works as expected. We can’t setup more frequently, otherwise rig won’t do full start until next check.

Inside ethOS terminal you should enter: sudo crontab -e. If you are setting your first cronjob – the system will ask about default editor. Our suggestion is to use “nano” (the second one). After editor is open, type in the new line:

*/15 * * * * bash /home/ethos/ 8 27

Change the last two numbers (8 and 27). First of them (8) means minimum required GPU count and the second one (27) – minimum mining speed of each card. If one of this check will fail – the system reboots.

After inserting this line, you should save & exit editor. To do that press CTRL + X, then enter “Y” and press Enter. The information in terminal about installing new crontab is like success message.

Keep in mind, that you can always check if everything is configured correctly by setting too high “limits”. In that case system must reboot within 15 minutes. Do not forget to revert parameters after the check.

Periodic restart

In case of unexpected situations, we strongly recommend adding one more scheduled job – for automatically every week restart. Configuration of such cronjob is very easy. We will set up a periodic restart at every Mondays 8 AM. Type sudo crontab -e in ethOS terminal and add new line:

0 8 * * 1 /sbin/shutdown -r now

Choose different times

For most non-Linux users, it is difficult to understand all those crontab numbers and asterixis at the beginning of the command. There are “translators”, where you can translate it to the English language and change timings if needed. Translator can be found here.


  1. Tried this and get an error on line 25 bad sentax “do”
    Or something along thos lines lol
    It’s definitely line 25 and “do” that’s the problem
    Ethos 1.3.3

  2. what happen if there suddenly internet temporally down, the speed is 0. Then the mining will keep continually restarting in loop until the internet back on. Can you limit amount of reboot? like 3 or 5 times?

  3. enter nano to create and save in a like this

    it will open blank file where you can past code from browser.
    the ctrl-X Y enter
    now you have created your file where its seen by ethos

  4. Hello and thank you. I start on ethos so I do not understand what you mean “save it in a” “.
    thank you in advance

    • it means if you are an windows user copy all the text the 39 lines and save in a .txt file.
      Then change the name and extension from newnote.txt to
      copy to the /local/ethos folder. (the same directory, where your local.conf and remote.conf exists)
      dont know how to change extension in a file? dont worry check on google.


Please enter your comment!
Please enter your name here