Last active
April 30, 2024 07:57
-
-
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.
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 -_-