Created
April 18, 2013 18:01
-
-
Save petrblahos/5414866 to your computer and use it in GitHub Desktop.
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/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