Last active
September 30, 2023 20:11
-
-
Save haron/58a156d83527bbe1e450aedc7b5c0642 to your computer and use it in GitHub Desktop.
Command line tool to show Time Machine backup progress in a human-readable form (Python 3.8+)
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 python | |
import plistlib | |
import subprocess | |
res = subprocess.run("tmutil status -X", shell=True, capture_output=True).stdout | |
data = plistlib.loads(res) | |
if running := data["Running"]: | |
print("Backup is running") | |
print("Progress: %s%%" % (round(data.get("Progress", {}).get("Percent", -1) * 100, 2))) | |
print("BackupPhase:", data["BackupPhase"]) | |
print("Stopping:", data["Stopping"]) | |
else: | |
print("Backup is not running") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment