On 07/02/18 02:50, Alan Brown wrote:
I also submitted some chages to the mtx-changer script a while ago which
check that the changer's actually ready before attempting to send it
commands. Kern's been sitting on them for a couple of years.
@ -82,6 +66,7 @@ # $1 $2 $3
$4 $
fi
MTX=/usr/sbin/mtx
+TAPEINFO=/usr/sbin/tapeinfo
if test ${debug_log} -ne 0 ; then
touch /opt/bacula/working/mtx.log
@@ -93,7 +78,21 @@ # $1 $2 $3
$4 $
fi
}
-
+# AB 20151203 - wait for changer to be ready
+# wait up to 600 seconds
+i=0
+ while [ $i -le 600 ]; do # Wait max 600 seconds
+ if $TAPEINFO -f $1 2>&1 | grep "Ready: yes" >/dev/null 2>&1; then
+ if [ $i -gt 0 ]; then # Flush out any mtx bogosity.
+ $MTX status > /dev/null 2>&1
+ fi
+ break
+ fi
+ debug $dbglvl "Device $1 - not ready, retrying..."
+ sleep 1
+ i=`expr $i + 1`
+ done
+#
#
# Create a temporary file
#
@@ -135,7 +134,12 @@ # $1 $2 $3
$4 $
# The purpose of this function to wait a maximum
# time for the drive. It will
# return as soon as the drive is ready, or after
-# waiting a maximum of 300 seconds.
+# waiting a maximum of 600 seconds.
+#
+# AJB2: (was 300, updated to 600 because if the drive decides it needs
+# a cleaning cycle that could take longer than 5 minutes depending on the
+# age of the cleaning tape.)
+#
# 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.
@@ -144,7 +148,7 @@ # waiting a maximum of 300 seconds.
#
wait_for_drive() {
i=0
- while [ $i -le 300 ]; do # Wait max 300 seconds
+ while [ $i -le 600 ]; do # Wait max 600 seconds
if mt -f $1 status 2>&1 | grep "${ready}" >/dev/null 2>&1; then
break
fi
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users