Skip to content

Instantly share code, notes, and snippets.

@ccraig
Last active April 30, 2024 07:57
Show Gist options
  • Save ccraig/6676574 to your computer and use it in GitHub Desktop.
Save ccraig/6676574 to your computer and use it in GitHub Desktop.
My current rsync script for cloning my HD ( OS X 10.8 ). The rsync flags are what Carbon Copy Cloner uses.
#!/bin/bash
target_drive=/Volumes/Clone
if [ -d $target_drive ]; then
echo "Last backup: " `cat ~/.last_backup`
sudo echo "And we're off!"
echo "Started: " `date`
echo `date` > ~/.last_backup
sudo time nice -n19 rsync -A -X -H -go --numeric-ids -D --protect-decmpfs -l -rtpx -N --fileflags --force-change --protect-args --delete-before --ignore-errors --filter='._/Users/i/.rsync-filter' // ${target_drive}; bless -folder ${target_drive}/System/Library/CoreServices
else
echo "${target_drive} is not mounted"
fi
@ccraig
Copy link
Author

ccraig commented Sep 23, 2013

Why "sudo" the echo on line 5? This just helps me remember to type in my password by making me do that first thing. I would sometimes see the words "Started: " from line 6 and think it had started, then come back to it later to find out it's been waiting for me to type my password -_-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment