backup script
Joel Hammer
joel
Mon May 17 11:57:25 PDT 2004
I would insert some something like this to ensure the command worked:
/bin/tar -cvpzf $BACK_DIR/mail-$DATE.tar.gz $MAILDIR
[ $? -eq 0 ] && echo "Backup Worked " `date` | mail -s Backup YourAddress || echo "Backup Failed " `date` | mail -s Backup YourAddress
BTW, I haven't tried these exact commands.
Joel
On Fri, Dec 26, 2003 at 04:52:36PM -0800, 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.
>
> ==============================================================
>
> #!/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