A shell script and launchd config file to run daily backups on specified directories and upload them to tarsnap.
To use:
- Get a tarsnap account and set it up
- Make the
backup
executable - Change the value of the array:string in the org.btb.backup.plist file to the location of your
backup
. Use the full path name. - Place org.btb.backup.plist in your ~/Library/LaunchAgents directory
- If you change the name of the plist file, make sure that Label:string in the file matches
- Edit the $DIRS variable in the shell script to specify what directories you want to back up. The format is
<directory>:<name>
. This means that it will back up directory<directory>
and name the archiveYY-MM-DD-<name>-HHMM
.
Commands:
backup list
Lists the most recent successful backup dates
Other features:
- The shell script has a $SSIDHOME variable that lets you set the SSID name of your home network and will exit out of the script if you're on any other network.
- Logs are written by default to ~/logs/backup.log
Issues:
- The script strips white space in directories such as "/Google Drive/". To fix, I create a shadow directory that is a symlink to the real directory (e.g., .gdrive/ -> /Google Drive/). You can do this with
ln -s ~/Google\ Drive/ .gdrive
- Use full pathnames! Using something like
~/directory
can lead to problems. You're much better off to use/Users/<username>/directory
.