Details coming up!!!
LOL! This'll be a refreshing change. On most of the other boards I've tried posting to, I've tried giving lots of details and gotten no replies at all because no one wants to take the time to read & process it all!
1. I'm running Red Hat Enterprise 4 on kernel 2.6.9-55.EL (required for the drivers that operate the tape unit, an IBM TS3100).
2. I'm using Bash, and need to write this into a Bash script.
3. I originally said the source was a "file" to try to keep it simple.
The actual source of this data is the output of an inventory check command (which is part of the software package that came with the TS3100). I'll probably pipe the output directly from the inventory command, but could dump it into a file and manipulate it from there if required.
4. I need to generate this inventory output and have the script dig through it on a daily basis.
5. The ultimate purpose of this is to compare the data on the "Slot Address" line (the numbers 4097 & 4098 below) with the tape that's actually in each storage slot and make sure that all of the tapes are where they're supposed to be. The tape's ID number in the first example below is 000102L3 (near the end of the 11th line down).
The second example is of a Slot that was empty when the inventory check was run.
(The tapes can be moved manually; otherwise I wouldn't bother.)
Here are two sample items from the output of the inventory check command:
Slot Address 4097
Slot State ..................... Normal
ASC/ASCQ ....................... 0000
Media Present .................. Yes
Robot Access Allowed ........... Yes
Source Element Address ......... 4097
Media Inverted ................. No
Volume Tag, Length 36
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0000 - 3030 3031 3032 4C33 2020 2020 2020 2020 [000102L3 ]
0010 - 2020 2020 2020 2020 2020 2020 2020 2020 [ ]
0020 - 0000 0000 [.... ]
Slot Address 4098
Slot State ..................... Normal
ASC/ASCQ ....................... 0000
Media Present .................. No
Robot Access Allowed ........... Yes
Source Element Address Valid ... No
Media Inverted ................. No
Volume Tag, Length 36
0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0000 - 0000 0000 0000 0000 0000 0000 0000 0000 [................]
0010 - 0000 0000 0000 0000 0000 0000 0000 0000 [................]
0020 - 0000 0000 [.... ]
-----END OF EXAMPLE------
6. I have a script already made which cross-references the names of the tapes with the slot where they're supposed to be stored.
Hope that's not too much info. If you need more specifice, let me know.