Last active
August 29, 2015 14:04
-
-
Save steverobbins/731a394c448c1dd5917b to your computer and use it in GitHub Desktop.
Monitors a file's size and alerts you when it's stopped growing (useful if you need to wait for a long logging process to finish)
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 | |
if [ -z $1 ] | |
then | |
echo "Usage: watchsize <file>" | |
exit | |
fi | |
SIZELAST=0 | |
SIZENOW=1 | |
while [ $SIZENOW -gt $SIZELAST ] | |
do | |
sleep 1; | |
SIZELAST=$SIZENOW | |
SIZENOW=`du "$1" | cut -f1` | |
done | |
# ring da bell | |
echo -e '\a' || (echo -e '\a'; sleep 1; echo -e '\a') | |
echo "$1 has stopped growing at $SIZENOW bytes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment