#!/bin/sh
# Sync catalogs to externally mounted volume.
# nick@buraglio.com
RSYNC='/usr/bin/rsync'
ITUNESSRC='/Users/Shared/iTunes' # iTunes Folder
ITUNESDST='/Volumes/Volume_1/Catalog\ Backups/iTunes' #Destination for iTunes Backup
IPHOTOSRC='/Users/Shared/iPhoto' #iPhoto Folder
IPHOTODST='/Volumes/Volume_1/Catalog\ Backups/iPhoto' #Destination for iPhoto Backup
PARAMS='--ignore-existing --delete --progress --recursive --perms --times --size-only --whole-file' # Any parameters for rsync
EXCLUDEITUNES='-exclude='.*' -exclude='*.m4v'' # Files or folders for exclusion
EXCLUDEIPHOTO='-exclude='.*'' # Files or folders for exclusion
$RSYNC $PARAMS $EXCLUDEITUNES $ITUNESSRC $ITUNESDST
$RSYNC $PARAMS $EXCLUDEIPHOTO $IPHOTOSRC $IPHOTODST
Thats it. Since the "--delete" flag is in place, I recommend use of the "--dry-run" flag the first time to make sure it does what you want, since delete will remove everything in it's path and make the folder match. I just have this run from cron every day using this line in my users crontab.
@daily /opt/local/bin/rsynccatalogs.sh