Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
Last active May 21, 2018 04:02
Show Gist options
  • Save jfeilbach/53b768169051ab4a3d1bf983af675a91 to your computer and use it in GitHub Desktop.
Save jfeilbach/53b768169051ab4a3d1bf983af675a91 to your computer and use it in GitHub Desktop.
a watched pot never boils; time machine status and time remaining
RUN=$(tmutil status |grep 'Running' | awk '{ print $3 }' | tr -d ";")
if [[ "$RUN" = "1" ]]
then
echo running
while true
do
secs=$(tmutil status | grep 'TimeRemaining' |awk '{ print $3 }' | tr -d ";")
STATUS=$(tmutil status | awk '/_raw_Percent/ {print $3}' | grep -o '[0-9].[0-9]\+' | awk '{print $1*100}')
REM=$(printf '%dh:%dm:%ds\n' $(($secs/3600)) $(($secs%3600/60)) $(($secs%60)))
echo "$STATUS% complete $REM remaining"
sleep 60
done
else echo not running
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment