Skip to content

Instantly share code, notes, and snippets.

@frazei
Last active February 8, 2024 10:44
Show Gist options
  • Save frazei/106ffc9346bf31aa9bc5b3e5dd6d095c to your computer and use it in GitHub Desktop.
Save frazei/106ffc9346bf31aa9bc5b3e5dd6d095c to your computer and use it in GitHub Desktop.
Debug Apple timemachine in bash #apple #osx

How to debug Apple Time Machine from console/bash

Stream the log, live (like tail):

$ log stream --style syslog  --predicate 'senderImagePath contains[cd] "TimeMachine"' --info

Don't stream, but show the log end exit:

$ log show --style syslog  --predicate 'senderImagePath contains[cd] "TimeMachine"' --info

Percentuale di avanzamento (solo se è in funzione):

$ tmutil status | LC_NUMERIC="C" awk -F'"' '/_raw_Percent/ {print $4 * 100}'

Script che visualizza anche lo storico:

#!/bin/sh

filter='processImagePath contains "backupd" and subsystem beginswith "com.apple.TimeMachine"'

# show the last 12 hours
start="$(date -j -v-12H +'%Y-%m-%d %H:%M:%S')"

echo ""
echo "[History (from $start)]"
echo ""

log show --style syslog --info --start "$start" --predicate "$filter"

echo ""
echo "[Following]"
echo ""

log stream --style syslog --info --predicate "$filter"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment