#!/bin/sh # # @(#)Daily DOCS backup 1.0 6/15/06 red byer # copies file to backup directory with the date appended to the file name. # Be sure to "sudo chmod +x" this file or it won't run with periodic # PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin echo "Subject: `date` WEEKLY DOCS Backup" echo "" echo "Starting WEEKLY DOCS directory backup using rsync" EXCLUDES="--exclude tmp* --exclude *Cache* --exclude .Trash*" # NOTE: Must be ROOT to utilize mdutil, so it's commented out for now #spotlight_switch() #{ #Ê /usr/bin/mdutil -i $1 / #} ######################################## # This is the version used as of 10.4 ####################################### #spotlight_switch off ! test -d /Volumes/HARDDRIVE_DOCBAK && echo "Please mount the backup drive!" && exit rsync -avE --delete $EXCLUDES /Users/DOCS/ /Volumes/HARDDRIVE_DOCBAK/WEEKLY_BACKUPS/DOCSweekly_`date +%Y%m%d` #spotlight_switch on ######################################### # The following method was not working on OS 10.4, so switch to rsync ######################################### # cp -Rfp /Users/DOCS/ /Users/BACKUPS/DOCSbackup`date +%a` echo "DOCS Backup complete" echo "`date`" echo ""