cgminer-monitor

#!/bin/sh
# This file is for cron job

# This if for make sure the start cgminer when there is network problem
C=`pidof cgminer | wc -w`
if [ “$C” != “1” ]; then
killall -s 9 cgminer
sleep 1
/etc/init.d/cgminer restart
exit 0;
fi

A=`cat /tmp/cm.log`
B=`cgminer-api devs | grep “^ \[Last Valid Work\]”`
echo “$B” > /tmp/cm.log
if [ “$B” != “” -a “$A” == “$B” ]; then
killall -s 9 cgminer
sleep 1
/etc/init.d/cgminer restart
exit 0;
fi

vi /etc/crontabs/root
*/2 * * * * /usr/bin/cgminer-monitor

上一篇: