#!/bin/sh # # @(#)Daily DOCS backup 1.0 6/15/06 red byer # copies file to backup directory with "01_MON" etc prefixed # 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 +%a` DOCS Backup" echo "" echo "Starting 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/DAILY_SNAPSHOTS/`date +%u`_`date +%a`_DOCSbackup #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 ""