Created
September 18, 2020 13:51
-
-
Save ypujante/2e93e3a30146e84fb2ef8c9e6f19d91c to your computer and use it in GitHub Desktop.
Display TimeMachine logs (acts like tail -f)
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 | |
# Usage: tm-log.sh [last] | |
# last: displays up to "last" events before streaming. defaults to 1h (see --last option for log) | |
LAST=${1:-1h} | |
ARGS=( --info --predicate 'processImagePath contains "backupd" and subsystem beginswith "com.apple.TimeMachine"' ) | |
# Implementation note: tr -u and sed -l are required (nothing shown until buffer full otherwise!) | |
tmlog() { | |
/usr/bin/log "$@" "${ARGS[@]}" | tr -u -s ' ' | sed -l -n 's/com.apple.TimeMachine://gp' | cut -d' ' -f 1,2,10- | |
} | |
tmlog show --last $LAST | |
tmlog stream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment