Guest User

Tape Library Drivers Order Suggestion Device Paths Serial Sc

a guest
May 4th, 2018
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. #!/bin/bash
  2. # Script to suggest tape-library drives order and Bacula Configuration
  3. # Requires sg3_utils and lsscsi (yum -y install sg3_utils lsscsi)
  4. # http://bacula.us
  5.  
  6. byidpath=/dev/tape/by-id/
  7.  
  8. chnum=0 && for j in $(ls -la $byidpath* |grep sg | cut -f 5,7 -d "/" | sed 's/ /,/g' | cut -d "," -f 1)
  9. do
  10.   echo -ne "Autochanger $((chnum++))\t"
  11.   echo "  
  12.  Changer Device = $byidpath$j
  13. "
  14. done
  15.  
  16. drnum=0 && for i in $(ls -la $byidpath* |grep /nst |cut -f 5,7 -d "/" | sed 's/ /,/g' | cut -d ',' -f 1,3)
  17. do
  18.   static=$(echo $i | cut -f 1 -d ',')
  19.   stpath=$(echo $i | cut -f 2 -d ',' | cut -f 2 -d '/' | cut -c 2-)
  20.   echo "Drive  $(lsscsi -g | grep -e tape -e $stpath | cut -d "]" -f 2| grep $stpath | sed "s/^[ \t]*//")"
  21.   echo "$(sginfo -s $byidpath$static)"
  22.   echo "  Drive Index = $((drnum++))"
  23.   echo "  Archive Device = $byidpath$static
  24. "
  25. done
Advertisement
Add Comment
Please, Sign In to add comment