Post
Topic
Board Hardware
Re: Announcement: Bitmain launches AntMiner solution, 0.68 J/GH on chip
by
b00m3rang
on 26/11/2014, 11:48:21 UTC
A friend mentioned that occasionally one of his AntMiners would randomly stop hashing, but would start right back up after restarting.  I thought it might be handy to write a script to do that automatically to minimize downtime without taxing the miner by power cycling it.  This ash script, triggered by cron, checks every 10 minutes to see how long it's been since the last work was submitted, and if it's been >10 minutes it will restart the miner and log the time in /root/watchdog.log.

Just save this as /root/watchdog.ash, make it executable, and add the job to Scheduled Tasks.

Code:
#!/bin/ash
# /root/watchdog.ash for AntMiner - 2014.11.26 - by b00m3rang

# You must run 'chmod 755 /root/watchdog.ash' or set +x in SCP client,
# and add the following line to "Scheduled Tasks" under "System":
# * */6  *   *   *     /root/watchdog.ash

# Assgn variables for current time and time of last work accepted
currtime=$(date +"%s")
lastwork=$(cgminer-monitor 2>&1 1>/dev/null | grep A= | awk '{ print $7 }')

# Calculate seconds since last work accepted
sincework=$(echo $((currtime-lastwork)))

# If no work submitted in the last 10 minutes, log and reboot
if [ $sincework -gt 600 ]; then
    echo `date` >> /root/watchdog.log
    reboot
fi

Let me know if you have any problems or improvements.