Created
November 22, 2013 22:02
-
-
Save chilyashev/7607628 to your computer and use it in GitHub Desktop.
My personal "Cloud infrastructure support"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################################################## | |
# Watches the core temperature and if it's greater than 80 degrees, vmware gets killed # | |
######################################################################################## | |
temperature=`sensors|grep -i 'core 0'|cut -d' ' -f9|sed s/'[\+|C|°]'//g` | |
if [ $EUID != 0 ]; then | |
echo "This fine piece of script must be run as root." | |
echo "And you, $USER, are certainly not root." | |
echo -e "\nSomething like \"sudo $0\" might work" | |
echo "Or maybe try this: " | |
echo "su -c $0" | |
exit | |
fi | |
echo "The temperature of Core 0 is $temperature°C"; | |
temp=${temperature/.*} | |
if [ $temp -gt 80 ] | |
then | |
xmessage "Killing vmware after you press OK..." | |
echo "Killing vmware..." | |
proc=$(ps -A|grep vmware|awk '{print $1}') | |
kill -9 $proc | |
else | |
echo "Everything's fine" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment