SUMMARY - Unattended ontape with jukebox tape drive.
Posted in 1998
Morning Folks
Well this is not really a summary, but having sifted through the archives =
I could not find any postings about how one could automate ontape to work =
against a jukebox drive, on a backup using multiple tapes.=20
So I am calling this a summary.
Some time ago Sky Southwell pointed me in the right direction for using =
the mt command to advance the tape, but how to get a response back to =
ontape eluded me.
Until it was resolved in a 5 minute bull session with a bunch of folks.=20
(The usual humbling experience)
So here it is.
Note: There is *absolutely no warranty* on the use of this script.
#!/bin/ksh
#Usage: auto_ontape.sh | ontape -s > /tmp/auto_ontape.log
#Methodology: Ontape writes out to standard output when it
# wants a new tape. By redirecting this
# and reading the output, it is possible
# for this script to react at the=20
# correct moment to advance the jukebox
# to a new tape, and then advise ontape
# to continue.
# Concepts tested and proven on Solaris 2.5
# Standard SUN Jukebox drive.
# Script may require minor amendment for other
# systems.
# NO WARRANTY NO WARRANTY
#--------------------------------------------------------
=20
=20
#Send a zero to ontape for archive level
echo "0"
#send an additional carriage return for 'Mount tape 1,any key to continue'
echo=20
#The log will have the request to mount a tape on the last line.
#Since it will already be mounted, we do not want the check in
#the while loop (below) to trigger a cycling of the tape,
#So put some garbage on the last line of the log.
echo "\\n first Time in \\n" >>/tmp/auto_ontape.log
#This checks the log every minute to see if ontape
#is asking for a new tape. If it is then the
#jukebox is advanced to the next tape, and ontape
#then is advised to continue with the backup.
#A 120 second pause occurs to allow time for the drive
#to advance. An alternative would be to use the 'mt' command
#to check status, if 120 seconds is a bother to anyone.
while true
do
sleep 60 # check every minute to see if ontape wants a new tape
CHECK=3D`tail -1 /tmp/auto_ontape.log | awk '{print $2}'`
if [ $CHECK =3D=3D "mount" ]
then
mt -f /dev/rmt/0 offline
sleep 120 #Give the tape time to cycle
#This echo means that the 'mount' keyword will no
#longer be on the last line of the log.
echo "\\n Tape has been changed \\n" >> /tmp/auto_ontape.log
echo #Carriage return to advise online that tape has changed
fi
#This check is never struck as the script will die when ontape
#finishes.
if [ $CHECK =3D=3D "over." ]
then
exit
fi
done
regards
Peter Tashkoff <tashkop@iname.com>
Principal Consultant
Marketing Database Systems Ltd