Skip to content

Instantly share code, notes, and snippets.

@petrblahos
Created April 18, 2013 18:01
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 petrblahos/5414866 to your computer and use it in GitHub Desktop.
Save petrblahos/5414866 to your computer and use it in GitHub Desktop.
#!/bin/sh
sleep 2400
state=`grep "sd[ab] " /proc/diskstats`
same_counter=0
echo "starting" >> /haltit
while [ ${same_counter} -le 60 ] ; do
sleep 60
newstate=`grep "sd[ab] " /proc/diskstats`
if [ "$state" = "$newstate" ] ; then
same_counter=`expr "$same_counter" + 1`
echo "SAME ${same_counter}" >> /haltit
else
echo "DIFFERENT" >> /haltit
same_counter=0
fi
state="$newstate"
done
echo "halt" >> /haltit
halt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment