LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Simple help with a backup script (http://www.linuxquestions.org/questions/linux-software-2/simple-help-with-a-backup-script-325314/)

GraemeK 05-20-2005 06:12 AM

Simple help with a backup script
 
Hiya,

I'm running Fedora core 3 on an old SCSI box of mine. I have a SONY 7000 DDS DAT drive in it. Now I have the KDE desktop working and i've managed to use KDAT to backup my /var/spool/mail file. that is my imap mbox file.

I want to leave a tape in the drive and then have a cron job backup /var/spool/mauk/username every day. just incase the mbox file gets corrupt.
I dont want the tape to eject.

I would like to use a simple program like TAR for backup so the backp 'could' be restored on any Linux box regardless of distro.

As i've said above, I know the tape drive is working under the KDAT GUI app so i dont see why it wouldnt work on the CMD with a Cron job?

Whats best to start? and how can i test the script to confirm it works?

Please remind me where the cron jobs go? I think theres a crontab file where you refernce the job and time etc then you stick the script in cron daily?

thanks.

mjsurette 05-20-2005 11:43 PM

Personally I use star (streaming tar) from http://cdrecord.berlios.de/old/private/star.html It's designed for use with tape drives and gives me dramatically quicker backups.

Here is a short script that should fill your needs. It's a highly stripped down version of what I use. Be sure to check that the directories are right for you.

#!/bin/bash
# a few constants

TarDir="/var/spool/mail"
Drive="/dev/st0"
MT="/opt/schily/bin/mt -f ${Drive}"
STAR="/opt/schily/bin/star"
OPT="-c -h -v -fifostats f=${Drive}"
DATE="/usr/bin/date"

echo "=============================================="
echo `$DATE` "start backup"
cd $TarDir
$STAR $OPT *
echo `$DATE` "taping complete"


All times are GMT -5. The time now is 02:05 AM.