Listing 3: dailybak.sh
#
# dailybak.sh: daily backup script
#
# Makes FULL backup of /u4 (w/compression) each day,
# and incremental backups of all other filesystems.
#
# Create combined daily log file Incr_log in Logs directory
# (/u3/Backup/Logs), and save previous three as .2, .3 and .4.
#
# The "dataset" program is used to position the tape for each
# incremental filesystem dump, as follows:
#
# dataset # filesystem
# 1 root (ALL EXCEPT /u, /u[1-5])
# 3 /u
# 5 /u2
# 7 /u3
# 9 /u1
# 11 /u5
# 13 /u4
#
LOGDIR=/u3/Backup/Logs; export LOGDIR
INCRLOG=$LOGDIR/Incr_log; export INCRLOG
[ -r $INCRLOG.5 ] && rm $INCRLOG.5
[ -r $INCRLOG.4 ] && mv $INCRLOG.4 $INCRLOG.5
[ -r $INCRLOG.3 ] && mv $INCRLOG.3 $INCRLOG.4
[ -r $INCRLOG.2 ] && mv $INCRLOG.2 $INCRLOG.3
[ -r $INCRLOG ] && mv $INCRLOG $INCRLOG.2
echo "`date`: Beginning nightly backup routine" >$INCRLOG
# Make incremental compressed backups of remaining filesystems:
CTARFILE=$LOGDIR/Incr_temp; export CTARFILE
echo "`date`: Backing up root: \n" >>$INCRLOG
./incrbak.sh root
cat $CTARFILE >> $INCRLOG
echo "`date`: root backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
dataset 3
echo "`date`: Backing up /u: \n" >>$INCRLOG
./incrbak.sh u
cat $CTARFILE >> $INCRLOG
echo "`date`: /u backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
dataset 5
echo "`date`: Backing up /u2: \n" >>$INCRLOG
./incrbak.sh u2
cat $CTARFILE >> $INCRLOG
echo "`date`: /u2 backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
dataset 7
echo "`date`: Backing up /u3: \n" >>$INCRLOG
./incrbak.sh u3
cat $CTARFILE >> $INCRLOG
echo "`date`: /u3 backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
dataset 9
echo "`date`: Backing up /u1: \n" >>$INCRLOG
./incrbak.sh u1
cat $CTARFILE >> $INCRLOG
echo "`date`: /u1 backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
dataset 11
echo "`date`: Backing up /u5: \n" >>$INCRLOG
./incrbak.sh u5
cat $CTARFILE >> $INCRLOG
echo "`date`: /u5 backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
# Make full compressed /u4 backup:
dataset 13
echo "`date`: Backing up /u4 (full dump): \n" >>$INCRLOG
./fullbakp.sh u4 # USE compression for /u4
full backup
echo "`date`: /u4 backup completed." >>$INCRLOG
echo "=================================================\n\n" >>$INCRLOG
echo "`date`: Done with nightly backup routine" >>$INCRLOG
|