backup script

Marianne Taylor mataylor
Mon May 17 11:57:25 PDT 2004


I am creating a script to backup my e-mail each night.  Attached is the 
script, but my only problem is that it isn't doing any of the hidden 
/directories or files.  I thought that tar would do this routinely?

Perhaps I have missed something obvious, any help would be greatly 
appreciated.

==============================================================

#!/bin/bash
# This script will backup e-mail nightly when called from cron


# first mount hda2 to store the backup onto
/bin/mount /dev/hda2

# next portion defines the maildir to backup
#this can be expanded as needed
MAILDIR=/home/user/.maildir

#defines the backup directory
BACK_DIR=/mnt/storage/backup/mail

#get date for file name
DATE=$(/bin/date +%F)


#tar command to compress the file - named with date and preserving permissions
cd $MAILDIR
/bin/tar -cvpz *  >$BACK_DIR/mail-$DATE.tar.gz

#e-mail to root to confirm done
echo "The mail has been backed up" | /usr/sbin/sendmail root

#un-mount /dev/hda2
#/bin/umount /dev/hda2

#End of the script



More information about the Linux-users mailing list