Back up Entourage data files automatically

Jul 07, '03 08:58:00AM

Contributed by: Anonymous

I use Entourage for email, news and for syncing with my Palm. I needed a way to backup the user area automatically to a single file so that I could use Backup to put that file to my idisk.

I decided to use shell scripting and make use of the /etc/daily script that is called from cron via periodic. My script could be expanded and could be used on an XServe with multiple users. A System Admin could use this script to automatically create single file backups of their users' Entourage data in their home directories.

Here is the code as appended to the end of /etc/daily.

#
#Checking if Entourage is up and creating backup
#
ent_up=`ps ax | grep Entourage | grep -v grep | wc -l`
if [ $ent_up -gt 0 ]; then
  echo ""
  echo "Entourage is currently running - backup aborted"
  exit 1
fi
for user in [user1] [user2]
do
  echo ""
  echo "Creating New MSData file for $user"
  cd /Users/$user/Documents
  tar -cf $user_MSData.tar "Microsoft User Data"
  gzip -f $user_MSData.tar
  chown $user MSData.tar.gz
  echo "Finished Creating Entourage Backup for $user"
done
If you have lots of users or your usernames change, change the for users in line to:
for users in `ls /Users | grep -v Shared`
Of course, if you are on an Xserve, some people may not use Entourage, so you could always do a check for the directory /Users/username/Documents/Microsoft User Data directory and if it exists, then do the tar.

If you want to go further, you could do a find on *MSData.tar.gz and move those files to a central storage area to be backed up later. This way, you automatically backup all users' Entourage data daily, no matter how many users you have, and you don't have to worry about users being added / deleted. The command could be:
find /Users -name "*MSData.tar.gz" -exec mv {} /backup ;
[robg adds: I have not tested this script.]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030628173904984