Hi, I am new at this and was wondering if there is an easy way to view the contents of the data that got backed up onto my tape from my sco unix server. I need to check and make sure the data got backed up ok.
# This Section is used to inhibit users, until backup completes
# The file 'signoff.msg' is a simple message telling users that
# the system will be starting a backup in 5 minutes, asking
# them to sigh off gracefully. The 'passwd.min' is a copy of the
# active passwd file, with the sers remove.Only system user ( lp, bin , etc.. )
# should be in it along with root. The passwd.all is of course a passwd
# file will alusers in it. The passwd is copied to the passwd.all each time
# the script is run ( usually from cron ) in case new users are added.
# *****************************************************************************
wall < /usr/bin/signoff.msg
sleep 300
who -u > /usr/bin/wlist
awk '{ print "kill -9",$7 }' /usr/bin/wlist > /usr/bin/tempkill
chmod 777 /usr/bin/tempkill
/usr/bin/tempkill
cp /etc/passwd /etc/passwd.all
cp /etc/passwd.min /etc/passwd
# *********************** Start of backup script ***************************
# Define global variables
TAPE=/dev/rStp0
SAVEDIR=/usr/bin/save
TMPFILE=${SAVEDIR}/tmpfile
TMPFILE2=${SAVEDIR}/tmpfile2
SOURCE=/
CONSOLE=/dev/tty01
# Find today's day
DAY=`date +%a`
# Check to see if it is Monday
if [ $DAY = Mon ]
then
# Skip backup, and do nothing
echo "It is Monday, and we don't do a backup on Mondays" | $CONSOLE
# fixpasswd re-copies the passwd.all, and sends a message
# to specific tty device ( terminals ) informing users to
# log back on... the the script exits with errorlevel 2
/usr/bin/fixpasswd
exit 2
else
# Proceed
:
fi
# Determine the names of today's list and log
LIST=${SAVEDIR}/${DAY}.list
LOG=${SAVEDIR}/${DAY}.log
# Log the fact that we just started
echo "\n\n\rBackup started on `date`\r" | tee $LOG | tee $CONSOLE
# Move to the root of the system
cd $SOURCE
# Create a list of all files to save
echo "Creating backup list... Please wait." | tee -a $LOG | tee $CONSOLE
if [ $DAYNAME = Sun ]
then
find . -print | sed 's/^\.\///' > ${LIST}
else
find ./etc -print | sed 's/^\.\///' > ${LIST}
find ./usr -print | sed 's/^\.\///' >> ${LIST}
fi
# Make sure the tape is reset and retensioned
echo "Resetting the tape ... Please wait." | tee -a $LOG | tee $CONSOLE
tape reset
sleep 10
echo "Starting cpio backup .. Please wait." | tee -a $LOG | tee $CONSOLE
# Use cpio to back up data from the current directory (.)
# Save the cpio output in the log file.
cpio -ocv -O${TAPE} < $LIST
# If cpio failed, declare an error
if [ $? -ne 0 ]
then
echo "\rSomething went wrong with cpio on `date`\r" | tee -a $LOG | tee $CONSOLE
mail root < $LOG
# fixpasswd copies the passwd.all to passwd allowing users back on
# It also sends a message to each specific active terminal
# to inform users to log back on. Then exits with errorlevel 1
/usr/bin/fixpasswd
exit 1
fi
/usr/bin/fixpasswd
# Verify the backup
echo "\rVerifying the backup on `date`\r" | tee -a $LOG | tee $CONSOLE
cpio -itc -I${TAPE} > $TMPFILE2
cat $TMPFILE2 | awk '{ print $1 }' > $TMPFILE 2>> $LOG
diff $TMPFILE $LIST >> $LOG
if [ $? -ne 0 ]
then
echo "\rBackup verification failed.\r" | tee -a $LOG | tee $CONSOLE
mail root < $LOG
/usr/bin/fixpasswd
exit 1
else
echo "\rBackup verification succeeded.\r" | tee -a $LOG | tee $CONSOLE
fi
# Clean up
sleep 5
tape reset # Reset tape to make sure it releases $TMPFILE
sleep 5
cat ${TMPFILE} >> $LOG
sync # Flush the buffers
sleep 2
# *************************************************************************
# fixpasswd copies passwd.all back to passwd to allow users to log back on
# It also send a message to specific tty devices informing users to log back on
#/usr/bin/fixpasswd
#rm -f ${TMPFILE}
Ok, thanks. Ya I realized that after I ran the command. I guess I should have ran the command before I asked that question. Also, how can I tell the total space used on the tape?
depending on your tape drive....if it's got hardware compression you can't tell exactly.
you can tell how much data has been sent to/from the tape device with the
tape amount /dev/xStp0
command. This only valid on the last tape operation performed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.