#!/bin/csh -f #################################################################### # # This script reads files from a tape that were written with the # wfits shell script, using the `dd' option. # # Note: if using Sun Unix, change `mt -t' to `mt -f'... # # J.Brewer: 21 Feb.99 # Comments to: jbrewer@eso.org # #################################################################### # Check arguments... if($#argv != 1 || $1 == "-h" || $1 == "-?") then echo " " echo " Usage: "$0" number" echo " where number: number of files to read" echo " " echo "To see the inner workings of this script, type: more `which "$0"`" exit(-1) endif clear echo " " echo ">>> Please mail all bug reports to: jbrewer@eso.org <<<<" echo " " # Set the block factor, select tapedrive, check if drive exists... @ bl = 64 echo "Choose:" echo " 1 -- Read from DAT drive " echo " 2 -- Read from DLT drive" echo " " echo -n "Enter your choice... " set reply = $< if ($reply != '1' && $reply != '2') then echo "Enter 1 or 2..." exit(-1) endif if ($reply == '1') then # set dev = "/dev/rmt/0mn" # DAT drive, no rewind set dev = "/dev/rmt/0mnb" # DAT drive, no rewind with compression else # set dev = "/dev/rmt/1mn" # DLT drive, no rewind set dev = "/dev/rmt/1mnb" # DLT drive, no rewind with compression endif if !(-e $dev) then echo "Couldn't find drive "$dev" on this machine..." echo "Aborting..." exit(-1) endif # Start loop to extract the files... @ n=0 while ($n < $1) tar xvbf $bl $dev mt -t $dev fsf 1 # Position for next files... @ n += 1 end # Further tape options... echo " " echo "Choose:" echo " r -- Rewind " echo " o -- Rewind, take drive offline" echo " x -- Do nothing (default)" echo " " echo -n "Enter your choice... " set reply = $< if ($reply == 'r' || $reply == 'R') then echo "Rewinding tape..." mt -t $dev rew endif if ($reply == 'o' || $reply == 'O') then echo "Taking tape offline..." mt -t $dev offline endif exit(0)