-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlol_check
31 lines (28 loc) · 1.89 KB
/
lol_check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
grep -o 'Average speed.*$' /var/log/miner/lolminer/lolminer.log | tail -1 | sed 's/ Total.*$//;s/Average.*): //;s/mh\/s | /\n/g;s/mh\/s//' > /tmp/lol.log
gpu_count=$( wc -l /tmp/lol.log | sed -E 's/^([0-9]*) .*$/\1/' | bc )
if [[ "$gpu_count" -lt {lolgpus} ]] ; then
echo "script initiated due to an lolminer gpu missing at `date '+%Y-%m-%d_%H:%M:%S'`" >> /home/user/worker_check.log
sleep 180
tail -100 /var/log/miner/lolminer/lolminer.log | grep -o 'Average speed.*$' | tail -1 | sed 's/ Total.*$//;s/Average.*): //;s/mh\/s | /\n/g;s/mh\/s//;/^$/d' > /tmp/lol.log
if [[ "$gpu_count" -lt {lolgpus} ]] ; then
echo "script restarted worker due to an lolminer gpu missing at `date '+%Y-%m-%d_%H:%M:%S'`" >> /home/user/worker_check.log
# curl -X POST -H "Content-Type: application/json" -d '{"value1":"{rigname} restarted due to an lolminer gpu missing"}' https://maker.ifttt.com/trigger/notify/with/key/{iftttkey} ; wait
sreboot
fi
fi
while read line ; do
hash_rate=$( echo "$line" | sed -E 's/^([0-9]*)\..*$/\1/' | bc )
if [[ "$hash_rate" -eq 0 ]] ; then
echo "script initiated due to an lolminer gpu having no hashrate at `date '+%Y-%m-%d_%H:%M:%S'`" >> /home/user/worker_check.log
sleep 180
tail -100 /var/log/miner/lolminer/lolminer.log | grep -o 'Average speed.*$' | tail -1 | sed 's/ Total.*$//;s/Average.*): //;s/mh\/s | /\n/g;s/mh\/s//;/^$/d' > /tmp/lol.log
while read line ; do
hash_rate=$( echo "$line" | bc )
if [[ "$hash_rate" -eq 0 ]] ; then
echo "script restarted worker due to an lolminer gpu having no hashrate at `date '+%Y-%m-%d_%H:%M:%S'`" >> /home/user/worker_check.log
# curl -X POST -H "Content-Type: application/json" -d '{"value1":"{rigname} restarted due to an lolminer gpu having no hashrate"}' https://maker.ifttt.com/trigger/notify/with/key/{iftttkey} ; wait
sreboot
fi
done < /tmp/lol.log
fi
done < /tmp/lol.log