#!/usr/bin/perl # Author: Olaf Zaplinski -- o.zaplinski@broadnet.de $notfound = 1; $lineno = 0; $export_slots = 20; $scsi_id = "2.6.0"; open(JBSTAT, "/usr/sbin/sjirdtag ".$scsi_id."| ") || die "cannot open file"; while ( $notfound && ($line=) ) { $lineno+=1; chomp($line); $notfound = ( $line !~ /Element\ Type\ IMPORT\/EXPORT/ ); } $lineno = 0; while ( $line= ) { chomp($line); next if ( $line !~/Elem/ ); $lineno+=1; print "$lineno\t"; if ( $line =~ /full=0/ ) { if ( $line =~ /pres_val=0/ ) { print "this 5 tapes box is missing OR door is open" if ( $line =~ /full=0/ ); } else { print "EMPTY"; } } else { if ( $line =~ /tag_val=0/ ) { print "- UNKNOWN! -"; } else { $line=; chomp($line); $line =~ s/(^\W*VolumeTag.*=\<)(\d{6})(.+$)/$2/; $line =~ s/(^\W*VolumeTag.*=\<)(CLN\d{3})(.+$)/$2/; print "$line"; } $export_slots-=1; } print "\n"; } print "free IO ports: $export_slots / 20\n"; close(JBSTAT); exit ( $export_slots );