Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Back up Entourage data files automatically' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Back up Entourage data files automatically
Authored by: gatorparrots on Jul 15, '03 09:12:07PM
#!/bin/sh
##
# This script will backup the Entourage mail database to second location
# for seven days, removing older depreciated backups and starting anew
# Suggested usage: run nightly with cron
##
#initialize variables
username="$(who | grep console | awk '{print $1}')"
if [ "$username" = "" ]; then
    echo "No one logged in via GUI (console)" >&2
    exit 1
fi
userhome="$(eval echo ~$username)"
date=$(date +%Y.%m.%d)
backupdir="/Volumes/documents/backup/Entourage"
#clean up last week
if [ $(cd $backupdir && 'ls' -1 | wc -l) == 7 ]; then
	rm -rf $backupdir/*
fi
#Quit Entourage and give it time to write its database to disk
/usr/bin/osascript -e 'tell application "Microsoft Entourage" to quit'
/bin/sleep 5
#Copy the data & create a log
mkdir $backupdir/Entourage-$date
echo $date > $backupdir/backup.log
/usr/bin/ditto -rsrc -V "$userhome/Documents/Microsoft User Data/Office X Identities/Main Identity" "$backupdir/Entourage-$date/Main Identity" >> "$backupdir/backup.log"
echo "Backup successful" >> $backupdirp/backup.log
mv "$backupdir/backup.log" "$backupdir/Entourage-$date/backup.log"
#Relaunch Entourage
/usr/bin/osascript -e 'launch application "Microsoft Entourage"'


[ Reply to This | # ]