Re: Legato question about tape redundancy



Hello
Thanks, Ok I decided to write a script just to rotate the tapes each
time a backup runs- incremental or full, it stores the tape volume it
last mounted in a file, it works well so far. enclosed is the script I
know its long and doesnt do very much! Could someone tell me if nsrjb
-Cv , if the tapes are recyclable, then it prints just 'yes' or
anything else? I cannot remember and dont have any tapes that are in
recycle mode.

#!/bin/ksh
######
###### Legato Rotate Backup Script
######
######
###### Check nsrjb is in good state and reset/reinvent the jukebox
######
######
isrunning=`ps -ef | grep -w "nsrexec"; ps -ef | grep -w "nsrindexd -a"`
if [ ! -z $isrunning ]; then
  echo "\nError..looks like a backup is running. Exit now.\n"
  exit 1
fi
echo "\nResetting hardware and unloading jukebox .."
/usr/sbin/nsrjb -HE
if [ $? != 0 ]; then
  echo "Jukebox error.. exit now.\n"
  exit 1
else
  echo "\nPerforming fresh jukebox inventory..."
  nsrjb -I
fi
#######
#######
#######
case "$1" in
'full')
        echo "\nRotating FULL tape"
        tapelogfile=/var/tmp/tape-log/lastfull
        tapes=`nsrjb -Cv | grep -w "Full" | grep "%" | awk {'print $2
'} | sort -n`
        rec_tapes=`nsrjb -Cv | grep -w "Full" | grep "yes" | awk
{'print $2 '} | sort -n`
        ;;
'inc')
        echo "\nRotating INCREMENTAL tape"
        tapelogfile=/var/tmp/tape-log/lastinc
        rec_tapes=`nsrjb -C -v | grep -w "NonFull" | grep "yes" | awk
{'print $2 '} | sort -n`
        ;;
*)
        echo "\nUsage: $0 { full | inc }\n"
        exit 1
        ;;
esac
#######
#######
####### Set variables
#######
#######
lasttape=`echo $tapes | awk '{print $NF}'`
firsttape=`echo $tapes | awk '{print $1}'`
tapelogfiledir=/var/tmp/tape-log
#######
#######
####### Start Program
#######
#######
####### Test Stupid conditions
#######
#######
if [ ! -d $tapelogfiledir ]; then
  echo "Error no tape log file directory, exit now."
  exit 1
fi
if [ -z $tapes ]; then
  echo "Error - sorry no tapes to write to."
  echo "Now trying to find any recyclable tapes.."
  if [ ! -z $rec_tapes ]; then
  echo "Found some recyclable tapes. Using those ones."
  tapes=$rec_tapes
  else
   echo "Sorry no tapes at all to write to.."
   exit 1
fi
####### Start Rotating Tapes
#######
if [ ! -f $tapelogfile ]; then
  echo "No tape log file -- creating one and starting from first
tape.."
  echo $firsttape > $tapelogfile
  echo "Mounting first tape --> \c"
  echo $firsttape "into Jukebox\n"
  nsrjb -l -f /dev/rmt/0cbn $firsttape
  exit 0
fi
prevtape=`cat $tapelogfile`
isempty=`echo $tapes | grep $prevtape`
if [ -z $isempty ]; then
  echo "Fileformat is bad. Exit now.."
  echo "Removed faulty log file, run script again"
  rm $tapelogfile
  exit 1
elif [ `wc -l $tapelogfile | awk {'print $1'}` != 1 ]; then
  echo "Fileformat is bad. Exit now.."
  echo "Removed faulty log file, run script again"
  rm $tapelogfile
  exit 1
elif [ `head -1 $tapelogfile` = $lasttape ]; then
  echo "Replacing last tape with first tape.."
  echo $firsttape > $tapelogfile
  echo "Mounting first tape --> \c"
  echo $firsttape "into Jukebox"
  nsrjb -l -f /dev/rmt/0cbn $firsttape
else
  echo "Mounting next tape --> \c"
  nexttape=`echo $tapes | awk '{ for (i=1; i<=NF; i++) if($i ==
"'$prevtape'") {print $(i+1)} }'`
  echo $nexttape "into Jukebox"
  nsrjb -l -f /dev/rmt/0cbn $nexttape
  echo $nexttape > $tapelogfile
fi
echo

.



Relevant Pages

  • Ripping Tapes with Linux--How To
    ... the full script is located in the BASH ... My tape player is a portable style journalist's recorder from the ... The most irritating part of the recording process was setting the ... echo Starting de-noise procedure to file $TMP1 ...
    (comp.os.linux.misc)
  • Re: tape command for solaris 8
    ... >> Well to answer number one, how do you want to write to tape? ... > I do not want the tape to rewind after you write to it. ... # setenv each of these variables if the corresponding filesystem ...
    (comp.unix.solaris)
  • Re: tape command for solaris 8
    ... >> Well to answer number one, how do you want to write to tape? ... > I do not want the tape to rewind after you write to it. ... # setenv each of these variables if the corresponding filesystem ...
    (comp.sys.sun.admin)
  • SUMMARY: ufsdump and ufsrestore
    ... > I need a simple script to dump a server mirrored with solstice disksuite ... > tape, then demonstrate how to recover it to a new disk. ... mt -f /dev/rmt/0 rewind ... echo "backing up root" ...
    (SunManagers)
  • Re: check if a tape is inserted
    ... is there a way to check, if a tape is inserted in my aix box ... before running the scheduled backup. ... echo "0" ...
    (comp.unix.aix)