Skip to content

Instantly share code, notes, and snippets.

@vertrigo
Created June 28, 2012 13:03
Show Gist options
  • Select an option

  • Save vertrigo/3011257 to your computer and use it in GitHub Desktop.

Select an option

Save vertrigo/3011257 to your computer and use it in GitHub Desktop.
gnome-antifreeze-control-script
#!/bin/sh
while test 1
do
LOAD=`ps axo pcpu,fname,stat | grep gnome-sh | grep Rl |awk '{s=s+$1} END {print (s)}'|awk '{ split($0, n, "."); print n[1] + (substr(n[2], 1, 1) >= 5 ? 1 : 0) }'`
OUTPUT=`ps -e|grep gnome-shell|grep -v grep`
if [ $LOAD -gt "90" ] ; then
echo Freeze...
killall --signal SIGKILL gnome-shell
else if echo $OUTPUT | grep gnome-shell>/dev/null ; then
echo All right.
fi
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment