Created
November 27, 2010 03:59
-
-
Save stan/717551 to your computer and use it in GitHub Desktop.
Dropbox as incremental backup
This file contains hidden or 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
# http://finishtherace.net/wp/?p=622 | |
# Dropbox as incremental backup. | |
# Justin Schwalbe | |
# http://finishtherace.net/wp/?p=622 | |
password="trickypassword" | |
dropboxdir="~/Dropbox/backups/" #change this as needed, make sure it exists | |
backupfolders="/path/to/folder /path/to/second/folder /and/so/on" | |
############################## | |
# No need to edit below this # | |
############################## | |
datestring=`date +%d` | |
thisyear=`date +%y` | |
thismonth=`date +%m` | |
# seems dumb and redundant, but it is sorta needed | |
mkdir /tmp/Backups; cd /tmp/Backups | |
tar -czf backup$datestring.tgz $backupfolders | |
tar -zxf backup$datestring.tgz | |
rm backup$datestring.tgz | |
# hdiutil won't overwrite files, so if it exists, delete it. | |
if [ -f $dropboxdir/backup$datestring.dmg ] | |
then | |
rm $dropboxdir/backup$datestring.dmg | |
fi | |
# create the .dmg file | |
hdiutil create -srcfolder '/tmp/Backups' -encryption -passphrase $password -fs HFS+ -volname Backup$thismonth.$datestring.$thisyear | |
$dropboxdir/backup$datestring | |
# clean up our mess so tomorrow we can start fresh | |
rm -rf /tmp/Backups |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment