]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/scripts/mtx-changer.in
ebl update
[bacula/bacula] / bacula / scripts / mtx-changer.in
index 59f3d42335339978bd7049729ed8523c2d1a67a4..1a5ecc578bbbc8c8a155420783726abcb2d0faf5 100644 (file)
@@ -52,6 +52,10 @@ MTX=@MTX@
 # SunOS     No Additional Sense
 # FreeBSD   Current Driver State: at rest.
 # Linux     ONLINE
+#  Note Debian has a different mt than the standard Linux version. 
+#    When no tape is in the drive it waits 2 minutes.  
+#    When a tape is in the drive, it prints user unfriendly output.
+#
 
 OS=`uname`
 case ${OS} in
@@ -61,8 +65,12 @@ case ${OS} in
   FreeBSD)
     ready="Current Driver State: at rest."
     ;;
-  *)
-    ready="ONLINE"
+  Linux)
+    if test -e /etc/debian_version ; then
+       ready="drive status"
+    else
+       ready="ONLINE"
+    fi
   ;;
 esac
 
@@ -108,7 +116,7 @@ make_temp_file() {
 wait_for_drive() {
   i=0 
   while [ $i -le 300 ]; do  # Wait max 300 seconds
-    if mt -f $1 status | grep ${ready} >/dev/null 2>&1; then
+    if mt -f $1 status 2>&1 | grep "${ready}" >/dev/null 2>&1; then
       break
     fi
     debug "Device $1 - not ready, retrying..."
@@ -189,6 +197,10 @@ case $cmd in
       ${MTX} -f $ctl status >${TMPFILE}
       rtn=$?
       cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
+
+# If you want/can use IMPORT/EXPORT slots as normal slots within bacula
+# replace the previous line by this one
+# sed "s/ IMPORT\/EXPORT//" "${TMPFILE}" | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
 #
 # If you have a VXA PacketLoader and the above does not work, try
 #  turning it off and enabling the following line.