Workaround for Time Machine skipping automated backups
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
#!/bin/bash | |
# .tmfix.sh - workaround for Time Machine skipping automated backups | |
# | |
# Put this script in: ~/.tmfix.sh | |
# Fill this with your Time Machine dir: | |
TMDRIVE="/Volumes/Time Machine/" | |
# And add something like this to your crontab: | |
# * * * * * /Users/Nyr/.tmfix.sh > /dev/null 2>&1 | |
# if it's the first time... | |
if [[ ! -e ~/.lastbackup ]]; then | |
touch ~/.lastbackup | |
exit | |
fi | |
oldenough=$(find ~/.lastbackup -mmin +60) | |
if [[ ! -z $oldenough ]]; then | |
# exit if a backup is currently running | |
if [[ -e ~/.doingbackup ]]; then | |
exit | |
fi | |
# exit if time machine drive isn't mounted | |
if [[ ! -e $TMDRIVE ]]; then | |
exit | |
fi | |
touch ~/.doingbackup | |
tmutil startbackup -b | |
touch ~/.lastbackup | |
rm ~/.doingbackup | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment