Commit be82ae5b authored by Michael J. Smith's avatar Michael J. Smith
Browse files

Added speed tracking

parent 15d1eb46
......@@ -18,16 +18,21 @@ if [[ ! -f ./startDate ]]
date +%s > ./startDate
fi
date1=$(cat startDate)
startTime=$(cat startDate)
dirPath=$1
prevSize="$(du -sk "$dirPath" | cut -f1 -)"
counter=0
speed=0
while(true); do
timerString="$(date -u --date @$(($(date +%s) - date1 - 86400)) +%-j:%H:%M:%S)"
humanSizeString="$(du -sh "$dirPath" | cut -f1 -)"
sizeString="$(du -s "$dirPath")"
outString="$timerString\t$humanSizeString\t$sizeString"
curTime="$(date +%s)"
timerString="$(date -u --date @$((curTime - startTime - 86400)) +%-j:%H:%M:%S)"
curSize="$(du -sk "$dirPath" | cut -f1 -)"
humanSizeString="$(du -sh "$dirPath")"
speedString="$((((curSize - prevSize) / 1024) / frequency)) MB/s"
outString="$timerString\t$curSize\t$humanSizeString\t$speedString "
filteredOutString=$(echo -ne "$outString" | grep -v "cannot access" -)
echo -ne "$filteredOutString\r"
prevSize=$curSize
sleep "$frequency"
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment