Open+Directory+Archive



Open Directory Archive
Performing OD archives with a script:- -


 * 1) !/bin/sh
 * 2) set -xv; exec 1>>/tmp/out 2>&1

PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH BUPATH="/Volumes/data_hd/backups" FROMMAIL="you@domain.edu" TOMAIL="you@domain.edu"

FILE="/tmp/sacommands.txt" LOCATION=$BUPATH/od_archives/`date "+%Y.%m.%d"` LOGS="/tmp/logs.txt"

mkdir -p $BUPATH/od_archives/ find $BUPATH/od_archives/* -mtime +21 -exec rm -rf {} \; echo "dirserv:backupArchiveParams:archivePassword = PASSWORD" > $FILE echo "dirserv:backupArchiveParams:archivePath = $LOCATION" >> $FILE echo "dirserv:command = backupArchive" >> $FILEserveradmin command < $FILE echo "To: "$TOMAIL > $LOGS echo "From: `hostname` Daily Report " >> $LOGS echo "Subject: Daily `hostname` Backup Report" - `date` >> $LOGS echo "The Open Directory Master at `hostname` has been successfully backed up. It's location is `hostname` in a folder called "$LOCATION". It will be available for twenty-one days. After twenty-one days, the archive will be deleted." >> $LOGS cat $LOGS | sendmail -f $TOMAIL -t rm -rf $FILE rm -rf $LOGS