]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/scripts/mtx-changer.in
Finally... the 100% of bacula spanish !!! ;-)
[bacula/bacula] / bacula / scripts / mtx-changer.in
index a40e13769cf845cd3dd5be6a2601df9a9e74562f..5c7a5009ff385dc06d3fdb8735c3ae1428a4b0c5 100644 (file)
@@ -30,6 +30,8 @@
 #      loaded            which slot is loaded?
 #      list              list Volume names (requires barcode reader)
 #      slots             how many slots total?
+#      listall            list all info
+#      transfer
 #
 #  Slots are numbered from 1 ...
 #  Drives are numbered from 0 ...
@@ -120,12 +122,15 @@ check_parm_count() {
 #  all others are a minimum of 5
 #
 case $2 in
-    list)
+    list|listall)
        check_parm_count $# 2
        ;;
     slots)
        check_parm_count $# 2
        ;;
+    transfer)
+        check_parm_count $# 4
+        ;;
     *)
        check_parm_count $# 5
        ;;
@@ -183,6 +188,49 @@ case $cmd in
       exit $rtn
       ;;
 
+   listall)
+#  Drive content:         D:Drive num:F:Slot loaded:Volume Name
+#  D:0:F:2:vol2        or D:Drive num:E
+#  D:1:F:42:vol42   
+#  D:3:E
+# 
+#  Slot content:
+#  S:1:F:vol1             S:Slot num:F:Volume Name
+#  S:2:E               or S:Slot num:E
+#  S:3:F:vol4
+# 
+#  Import/Export tray slots:
+#  I:10:F:vol10           I:Slot num:F:Volume Name
+#  I:11:E              or I:Slot num:E
+#  I:12:F:vol40
+      debug "Doing mtx -f $ctl -- to list all"
+      make_temp_file
+      if test ${inventory} -ne 0 ; then
+       ${MTX} -f $ctl inventory
+      fi
+      ${MTX} -f $ctl status >${TMPFILE}
+      rtn=$?
+      # can be converted to awk+sed+cut, contributions are welcome
+      perl -ne '
+/Data Transfer Element (\d+):Empty/ && print "D:$1:E\n";
+/Data Transfer Element (\d+):Full \(Storage Element (\d+) Loaded\)(:VolumeTag =\s*(.+))?/ && print "D:$1:F:$2:$4\n";
+/Storage Element (\d+):Empty/ && print "S:$1:E\n";
+/Storage Element (\d+):Full( :VolumeTag=(.+))?/ && print "S:$1:F:$3\n";
+/Storage Element (\d+) IMPORT.EXPORT:Empty/ && print "I:$1:E\n";
+/Storage Element (\d+) IMPORT.EXPORT:Full( :VolumeTag=(.+))?/ && print "I:$1:F:$3\n";' ${TMPFILE}
+      rm -f ${TMPFILE} >/dev/null 2>&1
+      exit $rtn
+      ;;
+
+   transfer)
+      slotdest=$device
+      debug "Doing transfer from $slot to $slotdest"
+      ${MTX} -f $ctl transfer $slot $slotdest
+      rtn=$?
+      exit $rtn
+      ;;
+
    loaded)
       debug "Doing mtx -f $ctl $drive -- to find what is loaded"
       make_temp_file