]> git.sur5r.net Git - bacula/bacula/commitdiff
Make prepare 2 tape script wait for drive to ready
authorKern Sibbald <kern@sibbald.com>
Mon, 26 Mar 2007 14:19:09 +0000 (14:19 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 26 Mar 2007 14:19:09 +0000 (14:19 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4427 91ce42f0-d328-0410-95d8-f526ca767f89

regress/scripts/prepare-two-tapes.in
regress/tests/two-volume-tape

index 8d47b7e8c0bbb2ca8960da6c94fe1539211ca685..611fb906f7d05e973adff78018a2d3af5452bb3c 100755 (executable)
@@ -1,14 +1,41 @@
 #!/bin/sh
 #
 # Create two blank tapes
+#
+OS=`uname`
+case ${OS} in
+  SunOS)
+    ready="No Additional Sense"
+    ;;
+  FreeBSD)
+    ready="Current Driver State: at rest."
+    ;;
+  *)
+    ready="ONLINE"
+  ;;
+esac
+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
+      break
+    fi
+#   debug "Device $1 - not ready, retrying..."
+    sleep 1
+    i=`expr $i + 1`
+  done
+}
+
 #
 # mt -f @tape_drive@ offline
 @changer_path@ -f @autochanger@ unload
 @changer_path@ -f @autochanger@ load 1
+wait_for_drive @tape_drive@
 mt -f @tape_drive@ rewind
 mt -f @tape_drive@ weof
 @changer_path@ -f @autochanger@ unload
 @changer_path@ -f @autochanger@ load 2
+wait_for_drive @tape_drive@
 mt -f @tape_drive@ rewind
 mt -f @tape_drive@ weof
 #@changer_path@ -f @autochanger@ unload
index b26e0a9d858a2540149c951c1b8fe92d0a9fefa4..83c9347bc1e3e9cc4aefb4603ed2c89f93bfed12 100755 (executable)
@@ -10,7 +10,6 @@ JobName=twovoltape
 . scripts/functions
 set_debug 0
 
-
 . config.out
 if test x${AUTOCHANGER} = x/dev/null ; then
    echo "two-volume-tape test skipped. No autochanger."