Skip to content

Instantly share code, notes, and snippets.

@disq
Created May 28, 2011 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save disq/997339 to your computer and use it in GitHub Desktop.
Save disq/997339 to your computer and use it in GitHub Desktop.
GPU Monitor to send mail when load drops to 0%
#!/bin/sh
RET=`DISPLAY=:0 aticonfig --odgc --adapter=all`
ZEROCNT=`echo ${RET}|grep GPU|grep "0%"|wc -l`
if [ $ZEROCNT -gt 0 ]; then
if [ -e ~/gpu-monitor.stop ]; then
echo "$ZEROCNT gpu still idle"
exit 0
fi
sleep 10
RET=`DISPLAY=:0 aticonfig --odgc --adapter=all`
ZEROCNT=`echo ${RET}|grep GPU|grep "0%"|wc -l`
if [ $ZEROCNT -gt 0 ]; then
echo "sound the alarm, $ZEROCNT gpu idle"
echo "`date` ${RET}" | sendemail -q -f from@gmail.com -t to@gmail.com -u "GPU idle" -s smtp.gmail.com:587 -o tls=auto -xu from@gmail.com -xp password-of-from-gmail
touch ~/gpu-monitor.stop && sync
exit 0
fi
fi
echo "its ok"
if [ -e ~/gpu-monitor.stop ]; then
rm -f ~/gpu-monitor.stop && sync
fi
#!/bin/sh
ZEROCNT=`find /tmp -name '5*txt' -mmin +1|wc -l`
if [ $ZEROCNT -gt 0 ]; then
if [ -e ~/hash-monitor.stop ]; then
echo "$ZEROCNT miners still idle"
else
echo "sound the alarm, $ZEROCNT miners idle"
echo "`date` ${ZEROCNT} miners are idle" | sendemail -q -f from@gmail.com -t to@gmail.com -u "GPU idle" -s smtp.gmail.com:587 -o tls=auto -xu from@gmail.com -xp password-of-from-gmail
touch ~/hash-monitor.stop && sync
fi
else
echo "its ok"
if [ -e ~/hash-monitor.stop ]; then
rm -f ~/hash-monitor.stop && sync
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment