backup script
Keith Morse
kgmorse
Mon May 17 11:57:26 PDT 2004
On Fri, 26 Dec 2003, Marianne Taylor wrote:
> 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.
This must explain some of the examples I've over time of other peoples
backup scripts. Namely "find" is used to develop an include list as a
file that is then used as an argument to tar. This might be easier than
getting tar to include those hidden files and directories.
>
> ==============================================================
>
> #!/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
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at smtp.linux-sxs.org
> Unsubscribe/Suspend/Etc -> http://smtp.linux-sxs.org/mailman/listinfo/linux-users
>
More information about the Linux-users
mailing list