Listing 1: autoback
#!/bin/ksh
cd /
if [ ! -d /home/qbridge/backups ]; then
mkdir /home/qbridge/backups
if [ $? -ne 0 ]; then
echo 'Cannot Create Directory!'; exit 1
fi
fi
#rmtx=`/bin2/bkpdevnm`
rmtx=rmt0
chdev -l $rmtx -a block_size=1024 >/dev/null
#fn=`date|colrm 4` # the day of the week
fn=`/bin2/dayofwk`
/bin/mkszfile -f
/bin/mksysb /dev/$rmtx \
2>/home/qbridge/backups/$fn.err \
>/home/qbridge/backups/$fn.listing
/bin/chown qbridge.qbridge /home/qbridge/backups/*
if [ ! -f /bin3/nounload ]; then
/bin/tctl -f/dev/$rmtx rewoffl
#tape is unloaded next morning for easy rotation
fi
rm /bin3/nounload
|