Taking backup on Tape
#!/bin/bash -x
# This script is useful for taking backup on Tape
# Tested on CentOS 3.8, CentOS 4.4
# For further info please login http://indianGNU.org or
# mail ravi <at> indianGNU.org
##### DECLARE AND INITIALIZE VARIABLES #####
### File with the full path names ###
DATE=`date +%m-%d-%g`
LOGDIR=/usr/local/admin/backup
BKDIR=/root/backup
TAPE1=$BKDIR/tape1
TAPE2=$BKDIR/tape2
TOC1=$LOGDIR/backup.$DATE/toc1
TOC2=$LOGDIR/backup.$DATE/toc2
ERR=$LOGDIR/backup.$DATE/errorlogs
GTAR=/bin/gtar
TAPE=/dev/st0
MT=/bin/mt
CP=/bin/cp
mkdir /usr/local/admin/backup/backup.$DATE
### Loop the the backup directory files ###
sleep 60
#$TIME > $TOC1
if [ -f “$TAPE1” ]; then
$MT -f $TAPE rewind;
$GTAR -cvf $TAPE -V “Tape1-Full.$DATE” $TAPE1
$CP $TAPE1 $TAPE2 $LOGDIR
for DIR1 in `cat $TAPE1`
do
$GTAR –exclude “simulation” -cvf $TAPE $DIR1 >> $TOC1 2>> $ERR
sleep 60;
done
$GTAR -cvf $TAPE $TOC1
$MT -f $TAPE rewoff
fi
### Loop the the backup directory files ###
sleep 180
#$TIME > $TOC2
if [ -f “$TAPE2” ]; then
$MT -f $TAPE rewind;
$GTAR -cvf $TAPE -V “Tape2-Full.$DATE” $TAPE2
for DIR2 in `cat $TAPE2`
do
$GTAR –exclude “simulation” -cvf $TAPE $DIR2 >> $TOC2 2>> $ERR
sleep 60;
done
$GTAR -cvf $TAPE $TOC2
$MT -f $TAPE rewoff
fi
#################################################
# Needed Additions to the backup script are: #
# Put table of contents on the end of the tape #
# Rotate through four sets of table of contents #
# in /usr/local/admin/backups #
#################################################
Thanks & Regards
Similar Posts:
- Subversion (svn/cvs) repository backup script
- Rsync Client script
- How to take Live-Backup of VMware(Esxi Server) VM host
- مؤتمرات متعددة المستخدم (يو للمؤتمر) عن جابر (Jabberd2)
- 多用户会议 (μ-会议的Jabber) (Jabberd2)
- Find command and Exclude subdirectory under searching with find command
- बहु प्रयोक्ता कान्फ्रेंसिंग (म्यू-सम्मेलन) अस्पष्ट के लिए Jabberd2 ()