#!/bin/ksh # edas2tape.scr # Copy hard disk EDAS subgrid (NCDC) archive file to tape file PATH=/bin:/usr/bin:/etc:/usr/ucb:$HOME/bin:/usr/bin/X11:.:/usr/local/bin:/usr/abin export PATH # set -nv HOST=`hostname` # Set block size to an even multiple of archive file record length # RAMARCOLD = 38x38+50=1494 (*10)=14940 # CBRAMARC = 42x46+50=1982 (*10)=19820 # NERAMARC = 78x74+50=1982 (*10)=58220 echo; echo "Enter RAMS Archive (cb or ne )" read atyp if [ $atyp = cb ];then BLOCK=19820 else BLOCK=58220 fi mdl=RAMS echo; echo "Enter dataset directory (/name)" read dir ls $dir echo; echo "Enter dataset filename" read mdl #-->check to see if desired data in file echo echo "This script copies the following to tape:" inspectarc ${dir}/${mdl} echo read ok?"Is this the desired data (y/n)? " if [ $ok = "y" -o $ok = "Y" ]; then echo else echo; echo "Get desired data and rerun $0 $1"; echo exit fi #-->choose tape drive # read cdev?"(1) 4 mm or (2) 8 mm?" cdev=1 if [ $HOST = 'gus' ];then TAPE4mm=rmt0 else TAPE4mm=rmt0 fi dev=$TAPE4mm #-->files to skip read sk?"Enter number of files to skip: " FILE=${dir}/${mdl} echo echo " ............... ${FILE} ................................." #----->load tape echo; echo "Insert tape; press 'c' to continue" read cont if [ $cont = "c" ]; then echo else echo Termination: $0 $1 exit fi #----->rewind echo; echo "Rewind the tape first? (y/n)" read rwnd if [ $rwnd = "y" ]; then tctl -f /dev/$dev rewind fi #-------->skip files if [ $sk -gt 0 ]; then echo Skipping $sk files tctl -f /dev/$dev.1 fsf $sk fi #-------->copy echo "Transferring data: $FILE ...to... /dev/$dev.1 (bs=$BLOCK)" if dd if=$FILE of=/dev/$dev.1 bs=$BLOCK conv=sync; then echo "Successful copy: $FILE " else echo "Error in copying $FILE" exit fi #-------->rewind echo; echo "Rewind the tape now? (y/n)" read rwnd if [ $rwnd = "y" ]; then tctl -f /dev/$dev rewind fi #-------->inventory echo; echo "Inventory the tape now? (y/n)" read invn if [ $invn = "y" ]; then echo "$cdev\n" | /pub/archives/utility/smtapeinv.scr $atyp qprt -Bnn -v8 -p12 filedump fi