]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/scripts/mtx-changer.in
kes Turn on Batch insert code by default as it now passes regression.
[bacula/bacula] / bacula / scripts / mtx-changer.in
index ddc04e85cd19896632a0110cdd5d74a74a077fd3..44a3e41b601bf0a1bc958e897b33ba49e37995fe 100644 (file)
 
 MTX=@MTX@
 
+# mt status output
+# SunOS     No Additional Sense
+# FreeBSD   Current Driver State: at rest.
+# Linux     ONLINE
+
+OS=`uname`
+case ${OS} in
+  SunOS)
+    ready="No Additional Sense"
+    ;;
+  FreeBSD)
+    ready="Current Driver State: at rest."
+    ;;
+  *)
+    ready="ONLINE"
+  ;;
+esac
+
 #
 # log whats done
 #
@@ -72,11 +90,13 @@ make_temp_file() {
 # Note, this is very system dependent, so if you are
 #   not running on Linux, you will probably need to
 #   re-write it, or at least change the grep target.
+#   We've attempted to get the appropriate OS grep targets
+#   in the code at the top of this script.
 #
 wait_for_drive() {
   i=0 
   while [ $i -le 300 ]; do  # Wait max 300 seconds
-    if mt -f $1 status | grep ONLINE  >/dev/null 2>&1; then
+    if mt -f $1 status | grep ${ready} >/dev/null 2>&1; then
       break
     fi
     debug "Device $1 - not ready, retrying..."
@@ -144,8 +164,8 @@ case $cmd in
 #
 # Increase the sleep time if you have a slow device
 # or remove the sleep and add the following:
-#     wait_for_drive $device
-      sleep 15
+#     sleep 15
+      wait_for_drive $device
       exit $rtn
       ;;