Skip to content

Instantly share code, notes, and snippets.

@checktravis
Last active October 6, 2018 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save checktravis/619dc80f7eb6300735f1bf5ba5d88384 to your computer and use it in GitHub Desktop.
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"
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