Last active
September 29, 2018 09:27
-
-
Save marsmensch/5488bfcf1238d62fcd8cb18d2d926986 to your computer and use it in GitHub Desktop.
automatic regular reboots for the Sia & Decred OBELISK SC1/DCR1 miners by ObeliskHQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will reboot an obelisk miner over an ssh connection from a | |
# Linux VM, docker container or Linux host. | |
# If you have a lot of different passwords set, you can also use the -f option | |
# for sshpass to supply a password file or even better: Use keyfiles instead! | |
# | |
# . * | , | |
# . o | |
# .---. | |
# = _/__~0_\_ . * o ' | |
# = = (_________) . | |
# . * | |
# * - ) - * | |
# | |
# contact@marsmenschen.com, 2018-09-29 | |
# twitter.com/marsmensch | |
# | |
export OB1_PASSWORD="obelisk" | |
export OB1_NETADDRESS="" | |
for OB1_NETADDRESS in $(cat hostfile.txt); do | |
echo "./rebootOB1.sh $OB1_NETADDRESS" $OB1_PASSWORD | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script will reboot an obelisk miner over an ssh connection. | |
# Adapted from upgradeOB1.sh for this single task. | |
# | |
# NOTE: You will need the environment variable OB1_PASSWORD set to the password | |
# of the remote machine, and you will need the environment variable | |
# OB1_NETADDRESS to the network address of the remote machine. | |
# | |
# CRON: | |
# To reboot on a schedule, create a cronjob such as: | |
# 0 1 * * * export OB1_PASSWORD="obelisk" OB1_NETADDRESS="192.168.1.254"; /usr/local/bin/rebootOB1.sh > /dev/null 2>&1 | |
# The above example will reboot the obelisk miner every night at 1 AM. | |
# | |
# MULTIPLE MINERS: | |
# To reboot multiple hosts with this script either create different CRON entries OR use a hostfile in a bash script loop | |
# like outlined in the reboot-multiple-miners.sh script | |
# | |
# contact@marsmenschen.com, 2018-09-29 | |
# twitter.com/marsmensch | |
# | |
: ${OB1_NETADDRESS?"Need to set a remote address for the remote control card."} | |
: ${OB1_PASSWORD?"Need to set a password for the remote control card."} | |
# Set the LEDs to alternating to indicate work in progress. | |
echo "Initiating remote reboot of the miner" | |
sshpass -p ${OB1_PASSWORD} ssh -o StrictHostKeyChecking=no root@${OB1_NETADDRESS} << ! | |
/usr/sbin/led_alternate && shutdown -r +5 & | |
exit | |
! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment