Last active
January 21, 2017 02:02
-
-
Save smj10j/7f342817b655dc33adf4b53d1d1f5322 to your computer and use it in GitHub Desktop.
Monitor and print a disk's write speed by doing a simple comparison of the used space over time. Can be useful for network mounts
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
#!/usr/bin/env bash | |
DISK="Moody Mona" # Name of a directory mounted in /Volumes | |
INTERVAL=15 | |
while true; do | |
s1=$(df -m | grep "$DISK" | awk '{print $3}') | |
echo "s1=$s1" >&2 | |
sleep $INTERVAL | |
s2=$(df -m | grep "$DISK" | awk '{print $3}') | |
echo "s2=$s2" >&2 | |
r=$(( (s2 - s1) / INTERVAL )) | |
echo "$DISK Write Rate: $r MB/S" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment