hacks/osxbackup/backup.command

77 lines
2.5 KiB
Plaintext
Raw Normal View History

2011-05-26 12:19:44 +00:00
#!/bin/bash
# mac homedir backup script.
# by jeffrey paul <sneak@datavibe.net>
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2
# see README
NOW="`date +%Y%m%d.%H%M%S`"
2011-07-05 21:29:44 +00:00
BACKUPDEST=${BACKUPDEST:-"${USER}@jfk1.datavibe.net:backup/"}
2011-05-26 12:19:44 +00:00
2012-12-19 00:17:00 +00:00
RSYNC="rsync.3.0.9"
2012-06-20 08:22:58 +00:00
OPTS="-rlptDPSyzh --no-owner --no-group --delete-excluded --delete"
2011-05-26 12:19:44 +00:00
RE=""
RE+=" --exclude=/Desktop/" # desktop is like a visible tempdir.
2011-05-26 12:19:44 +00:00
RE+=" --exclude=/Library/Safari/"
RE+=" --exclude=/Downloads/"
RE+=" --exclude=/Library/Application?Support/Ableton/"
# evernote syncs to its server:
RE+=" --exclude=/Library/Application?Support/Evernote/"
RE+=" --exclude=/Library/Application?Support/InsomniaX/"
RE+=" --exclude=/Music/iTunes/Album?Artwork/"
RE+=" --exclude=/Documents/Steam?Content/"
2012-06-20 08:22:58 +00:00
RE+=" --exclude=/.dropbox/"
2012-12-19 00:17:00 +00:00
RE+=" --exclude=/Documents/Dropbox/.dropbox.cache/"
2011-05-26 12:19:44 +00:00
RE+=" --exclude=/.cpan/build/"
RE+=" --exclude=/.cpan/sources/"
RE+=" --exclude=/Library/Logs/"
# keep your mail on the server!
RE+=" --exclude=/Library/Mail/"
RE+=" --exclude=/Library/Mail?Downloads/"
RE+=" --exclude=/Library/Application?Support/SecondLife/cache/"
RE+=" --exclude=/Library/Caches/"
RE+=" --exclude=/Library/Developer/Xcode/DerivedData/"
2012-12-19 00:17:00 +00:00
RE+=" --exclude=/Library/Developer/Shared/Documentation/"
2011-05-26 12:19:44 +00:00
RE+=" --exclude=/Library/iTunes/iPhone?Software?Updates/"
RE+=" --exclude=/Library/iTunes/iPad?Software?Updates/"
RE+=" --exclude=/Pictures/iPod?Photo?Cache/"
RE+=" --exclude=/Library/Application?Support/SyncServices/"
RE+=" --exclude=/Library/Application?Support/MobileSync/"
RE+=" --exclude=/Library/Application?Support/Adobe/Adobe?Device?Central?CS4/"
RE+=" --exclude=/Library/Safari/HistoryIndex.sk"
RE+=" --exclude=/Library/Application?Support/CrossOver?Games/"
RE+=" --exclude=/Library/Preferences/Macromedia/Flash?Player/"
RE+=" --exclude=/Library/PubSub/"
RE+=" --exclude=/Library/Cookies/"
2012-01-03 20:39:49 +00:00
RE+=" --exclude=/Library/Preferences/SDMHelpData/"
2011-05-26 12:19:44 +00:00
RE+=" --exclude=/Receivd/"
2012-01-03 20:39:49 +00:00
RE+=" --exclude=/Library/Application?Support/Steam/SteamApps/"
2012-06-20 08:22:58 +00:00
RE+=" --exclude=/VirtualBox?VMs/"
2011-05-26 12:19:44 +00:00
MINRE=""
MINRE+=" --exclude=/.fseventsd/"
MINRE+=" --exclude=/.Spotlight-V100/"
2011-07-05 21:29:44 +00:00
MINRE+=" --exclude=/.Trash/"
2011-05-26 12:19:44 +00:00
MINRE+=" --exclude=/.Trashes/"
MINRE+=" --exclude=/tmp/"
2011-07-05 21:29:44 +00:00
MINRE+=" --exclude=/.TemporaryItems/"
MINRE+=" --exclude=/.rnd/"
2012-06-20 08:22:58 +00:00
MINRE+=" --exclude=.DS_Store"
2011-07-05 21:29:44 +00:00
RE+=" ${MINRE}"
2011-05-26 12:19:44 +00:00
RETVAL=255
while [ $RETVAL -ne 0 ]; do
2011-07-05 21:29:44 +00:00
$RSYNC $OPTS $RE ${HOME}/ ${BACKUPDEST}/Home/
2011-05-26 12:19:44 +00:00
RETVAL=$?
sleep 1;
done
RETVAL=255
while [ $RETVAL -ne 0 ]; do
2011-07-05 21:29:44 +00:00
$RSYNC $OPTS /Applications/ ${BACKUPDEST}/Applications/
2011-05-26 12:19:44 +00:00
RETVAL=$?
2012-01-03 20:39:49 +00:00
sleep 1;
2011-05-26 12:19:44 +00:00
done