Created
April 6, 2016 07:32
-
-
Save bmb/f47f0191ca26bd72fcfe6c71a3bc25dd to your computer and use it in GitHub Desktop.
shell script to watch for slow file syncs
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 | |
# seconds between fdatasyncs | |
rate=1 | |
# report any sync drift gte to this | |
drift_threshold=2 | |
while true; do | |
sleep ${rate}s | |
mark1=`date +%s`; | |
echo "hello disk" >> datafile | |
sync -d ./datafile | |
mark2=`date +%s` | |
let "drift = mark2 - mark1" | |
if [ $drift -ge $drift_threshold ]; then | |
echo sync took $drift secs | |
echo mark1 $(date --date=@${mark1}) | |
echo mark2 $(date --date=@${mark2}) | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment