rlib/read_tape.rb
# Reads multiple tar images from tape drive /dev/nst0 into the target directory
# @param [String] target directory
Reads multiple tar images from tape drive /dev/nst0 into the target directory
Reads multiple tar images from tape drive / dev / nst0 into the target directory
def read_tape(into_directory:)
  $stderr.puts " ********************* Reading tape into #{into_directory} *********************"
  tar_count = 0
  counter = 0
  system( '/bin/mt -f /dev/nst0 fsf' )
  system( '/bin/mt -f /dev/nst0 rewind' )
  begin
    puts "Tape file index: #{tar_count}" 
    $stderr.puts "Tape file index: #{tar_count}" 
    system( '/bin/mt -f /dev/nst0 status' ) 
    system( "/bin/tar --directory=#{into_directory} -xvf /dev/nst0" )
    counter = $CHILD_STATUS == 0 ? 0 : counter + 1
    system( '/bin/mt -f /dev/nst0 fsf' ) 
    tar_count += 1
  end until counter >= 1
  puts 'Rewinding, then ejecting tape'
  system( '/bin/mt -f /dev/st0 eject' )
  $stderr.puts ' ********************* Completed. Tape may be removed  *********************'
end
def read_tape ( into_directory : ) $stderr . puts " ********************* Reading tape into #{into_directory} *********************" tar_count = 0 counter = 0 system ( '/bin/mt -f /dev/nst0 fsf' ) system ( '/bin/mt -f /dev/nst0 rewind' ) begin puts "Tape file index: #{tar_count}" $stderr . puts "Tape file index: #{tar_count}" system ( '/bin/mt -f /dev/nst0 status' ) system ( "/bin/tar --directory=#{into_directory} -xvf /dev/nst0" ) counter = $CHILD_STATUS == 0 ? 0 : counter + 1 system ( '/bin/mt -f /dev/nst0 fsf' ) tar_count += 1 end until counter >= 1 puts 'Rewinding, then ejecting tape' system ( '/bin/mt -f /dev/st0 eject' ) $stderr . puts ' ********************* Completed. Tape may be removed  *********************' end
Reads multiple tar images from tape drive /dev/nst0 into the target directory
Reads multiple tar images from tape drive / dev / nst0 into the target directory
# Read until we get at least 2 EOF's on the tape # got some tapes that work better for this # Put into the stdout log, so it bounds the file list. # Also put to stderr so we can see which file image is the problem. # Where are we on the tape. # Skip EOF marker # Rewind and eject the tape
into_directory
None