Skip to content

Instantly share code, notes, and snippets.

@stralex7
Last active June 26, 2022 08:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stralex7/2de3a59b386c8003b94c0f2287a133d3 to your computer and use it in GitHub Desktop.
Save stralex7/2de3a59b386c8003b94c0f2287a133d3 to your computer and use it in GitHub Desktop.

Asus ROG STRIX-GTX1070-O8G-Gaming

Always purge installed drivers before upgrade or re-install

/etc/rc.local

modprobe i2c-i801
modprobe i2c-smbus
modprobe iTCO-wdt
service watchdog start

DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 /usr/bin/nvidia-smi -i 0 -pl 110
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 /usr/bin/nvidia-settings --assign "[gpu:0]/GPUGraphicsClockOffset[3]=-100" --assign "[gpu:0]/GPUMemoryTransferRateOffset[3]=1100"

/lib/systemd/system/watchdog.service

[Unit]
Description=Miner Watch Dog Timer service
After=miner.service

[Service]
Type=simple
ExecStart=/opt/miner/wdt
Restart=always
RestartSec=3s

[Install]
WantedBy=default.target # WantedBy=multi-user.target ???

/opt/miner/wdt

#!/bin/bash

WDT_DEV=/dev/ttyACM0

while true
do
        if [[ -c $WDT_DEV ]] ; then
                echo '~U' >$WDT_DEV
        fi
        sleep 10
done

/opt/miner/card_list.sh

#!/bin/bash

for i in 0 1 2 3 4 5 6;
do
  ls -l /sys/class/drm/card$i/device | grep --color '0000:00:02.0\|$'
done

api_test.py

#!/usr/bin/env python3                                                                                                                
import argparse
import socket
import json
import time
import os

# reset if mh drops below this num
min_hashes=29750

# time for reboot + claymore to get share and start hashing
loop_seconds = 45
delay_seconds = 90

#tcp port
port=8080
def check_rig(host):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try:
        s.connect((host, port))
        print("connected")
        s.send('{"id":0,"jsonrpc":"2.0","method":"miner_getstat1"}\n'.encode("utf-8"))
        j=s.recv(2048)
        s.close()                                                                                                                     
        resp=json.loads(j.decode("utf-8"))
        resp=resp['result']
        hashes = int(resp[2].split(';')[0])
        print("KH/s=" + str(hashes))
        hash_ok=min_hashes < hashes
        print("hashes ok is: " + str(hash_ok))
        return hash_ok
    except TimeoutError:
        print("connection timeout")
    except ConnectionRefusedError:
        print("connection refused")
    except:
        print("exception")

    return False


parser = argparse.ArgumentParser(description='rigmon')
parser.add_argument('--host', action='store', dest="host", default="127.0.0.1", help='hostname of the rig to monitor')
#parser.add_argument('--port', action='store', dest="port", default="8080", help='tcp port of the rig to monitor')
args = parser.parse_args()
time.sleep(delay_seconds)
# main loop
while True:
    if not check_rig(args.host):
        print("resetting rig")
        os.system('/sbin/reboot')
    else:
        print("rig ok!")
    print( "loop sleep" )
    time.sleep(loop_seconds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment