Skip to content

Instantly share code, notes, and snippets.

@chilyashev
Created November 22, 2013 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chilyashev/7607628 to your computer and use it in GitHub Desktop.
Save chilyashev/7607628 to your computer and use it in GitHub Desktop.
My personal "Cloud infrastructure support"
#!/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