Last active
October 6, 2018 18:32
-
-
Save checktravis/619dc80f7eb6300735f1bf5ba5d88384 to your computer and use it in GitHub Desktop.
simple "how much longer" bash script (inspired by waiting on a disk to zero out with DD, watching "892044574720 bytes (892 GB, 831 GiB) copied, 9013 s, 99.0 MB/s"
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
if [ $# -lt 3 ] | |
then echo "expecting 3 numaric prams: # goal size in GB, # amount complete in GB, # speed in MB/s" | |
exit 1 | |
fi | |
goal=$1 | |
sofar=$3 | |
speed=$2 | |
onegbmb=1024 | |
echo "goal $1gb, so far $2gb, speed $3MB/s" | |
remain=$(($goal-$sofar)) | |
remMB=$(($remain*$onegbmb)) | |
echo "remaining $remain gb ($remMB mb)" | |
remTime=$(($remMB/$speed)) | |
echo "at $speed MB/s, $remTime seconds to go" | |
remMins=$(($remTime/60)) | |
echo "... or $remMins minutes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment