]> git.sur5r.net Git - bacula/bacula/commitdiff
- Back port changes to 1.38.5
authorKern Sibbald <kern@sibbald.com>
Wed, 22 Feb 2006 18:43:55 +0000 (18:43 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 22 Feb 2006 18:43:55 +0000 (18:43 +0000)
- Fix recycle SQL for StorageId.
- Fix misplaced quote in mtx-changer script.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2805 91ce42f0-d328-0410-95d8-f526ca767f89

12 files changed:
bacula/examples/autochangers/chio-bacula
bacula/examples/autochangers/chio-changer
bacula/examples/autochangers/chio-changer.Sony-TSL-SA300C
bacula/examples/autochangers/locking-mtx-changer
bacula/examples/autochangers/mtx-changer.Adic-Scalar-24
bacula/examples/autochangers/multiple-drive-changer.txt
bacula/examples/autochangers/solaris-mtx-changer
bacula/kes-1.39
bacula/scripts/disk-changer.in
bacula/scripts/mtx-changer.in
bacula/src/cats/sql_find.c
bacula/src/dird/recycle.c

index 82558c1bc9b53c91f2d9de45a3cf8f1339422f92..d988b0151a138b5798dbf6b3c59833d91588f2c6 100644 (file)
@@ -5,7 +5,7 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a
+#  Changer Command = "path-to-this-script/chio-bacula %c %o %S %a"
 #    you will have the following input to this script:
 #
 #  chio-bacula "changer-device" "command" "slot" "archive-device"
index 4eba4a306480556ae2ad3ccf60f73b6528d3a6ea..60d1ed099051e1f0541b36fb5dad9a6fef6e521f 100644 (file)
@@ -16,7 +16,7 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/chio-changer" %c %o %S %a
+#  Changer Command = "path-to-this-script/chio-changer %c %o %S %a"
 #    you will have the following input to this script:
 #
 #  chio-changer "changer-device" "command" "slot" "archive-device"
index 3710059664b99f8f2e0098b29de50d5ecf70eac9..758e416ebe7dcbf61e5f8643626cd79c648b5462 100755 (executable)
@@ -9,7 +9,7 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a
+#  Changer Command = "path-to-this-script/chio-bacula %c %o %S %a"
 #    you will have the following input to this script:
 #
 #  chio-bacula "changer-device" "command" "slot" "archive-device"
@@ -94,58 +94,58 @@ usage()
 
 case ${COMMAND} in
     unload)
-       # enable the following line if you need to eject the cartridge
-       #mt -f ${TAPE} off
-       #sleep 2
-       # If the changer is power cycled with a tape loaded in a drive
-       if [ `${fullpath_me} ${CHANGER} loaded` -gt 0 ]; then
-               free_slot=`${fullpath_me} ${CHANGER} loaded`
-               free_slot=`expr $free_slot - 1`
-               ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot
-       fi
-       ;;
+        # enable the following line if you need to eject the cartridge
+        #mt -f ${TAPE} off
+        #sleep 2
+        # If the changer is power cycled with a tape loaded in a drive
+        if [ `${fullpath_me} ${CHANGER} loaded` -gt 0 ]; then
+                free_slot=`${fullpath_me} ${CHANGER} loaded`
+                free_slot=`expr $free_slot - 1`
+                ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot
+        fi
+        ;;
 
     load)
-       ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE}
-       rtn=$?
-       # Increase the sleep time if you have a slow device
-       sleep $SLEEP
-       exit $rtn
-       ;;
+        ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE}
+        rtn=$?
+        # Increase the sleep time if you have a slow device
+        sleep $SLEEP
+        exit $rtn
+        ;;
 
     list)
-       if [ "${SIMULATE_BARCODE}" = "true" ]; then
-           if [ -f "$BARCODE_FILE" ]; then
-               cat $BARCODE_FILE | grep -v "^#"
-               exit 0
-           else
-               echo "Barcode file $BARCODE_FILE missing ... exiting!"
-               exit 1
-           fi
-       else
-           ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]"
-       fi
+        if [ "${SIMULATE_BARCODE}" = "true" ]; then
+            if [ -f "$BARCODE_FILE" ]; then
+                cat $BARCODE_FILE | grep -v "^#"
+                exit 0
+            else
+                echo "Barcode file $BARCODE_FILE missing ... exiting!"
+                exit 1
+            fi
+        else
+            ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]"
+        fi
       ;;
 
     loaded)
-       # echo "Request loaded"
-       ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$
-       rtn=$?
-       cat /tmp/mtx.$$ | grep "^slot .: <ACCESS>" | awk '{print $2+1}' | tr -d ":"
-       drive=`cat /tmp/mtx.$$ | grep "^drive .: <ACCESS>"`
-       if [ -n "$drive" ]; then
-               echo 0
-       fi
-       rm -f /tmp/mtx.$$
-       exit $rtn
-       ;;
+        # echo "Request loaded"
+        ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$
+        rtn=$?
+        cat /tmp/mtx.$$ | grep "^slot .: <ACCESS>" | awk '{print $2+1}' | tr -d ":"
+        drive=`cat /tmp/mtx.$$ | grep "^drive .: <ACCESS>"`
+        if [ -n "$drive" ]; then
+                echo 0
+        fi
+        rm -f /tmp/mtx.$$
+        exit $rtn
+        ;;
 
     slots)
-       # echo "Request slots"
-       ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":"
+        # echo "Request slots"
+        ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":"
       ;;
 
     *)
-       usage
+        usage
       ;;
 esac
index 8c43621b92b9d0ad0c5d110c8fcfe536bb5d98fb..c71169af39dd254b3b461afbd6b32c773a1186b7 100644 (file)
@@ -2,11 +2,16 @@
 #
 # Bacula interface to mtx autoloader
 #
+#  This script is not needed with Bacula version 1.38 or later
+#  since the Storage daemon automatically ensures that only one
+#  thread accesses the script at a time.     
+#
+#
 #  $Id$
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d
+#  Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d
 #    you will have the following input to this script:
 #
 #  mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index"
index 8f0dc9d5803dfa7cd5eddc34344783da3e6e691f..9cdf6372f4c016a42bf7d14390bc9ab35ef83856 100755 (executable)
@@ -6,7 +6,7 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d
+#  Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d"
 #    you will have the following input to this script:
 #
 #  mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index"
index 4d2ceca83af61eb23a5bbcbbec101e0a9d60cb6d..e9fe18d41f1efc7da9b65ac7ced880a4b60585b5 100644 (file)
@@ -99,7 +99,7 @@ Content-Disposition: inline;
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/multitape-changer" %c %o %S %a %d
+#  Changer Command = "path-to-this-script/multitape-changer %c %o %S %a %d"
 #    you will have the following input to this script:
 #
 #  multitape-changer "changer-device" "command" "slot" "archive-device" "drive-index"
@@ -255,4 +255,3 @@ case $cmd in
 esac
 
 --------------050209030507060501040304--
-
index fd86992a44245534d459c117d76c2f12ca0fa56d..6f6859585914813f54577b068d2b9d69cc77324d 100755 (executable)
@@ -8,11 +8,11 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d
+#  Changer Command = "path-to-this-script/mtx-changer  %c %o %S %a %d"
 #    you will have the following input to this script:
 #
 #  mtx-changer "changer-device" "command" "slot" "archive-device" "drive-index"
-#                 $1              $2       $3        $4               $5
+#                  $1              $2       $3        $4               $5
 #
 #  for example:
 #
@@ -92,10 +92,10 @@ case $cmd in
      ;;
    *)
      if test $# -lt 3; then
-       echo "usage: mtx-changer ctl-device command slot archive-device drive"
-       echo "  Insufficient number of arguments arguments given."
-       echo "  Mimimum usage is first three arguments ..."
-       exit 1
+        echo "usage: mtx-changer ctl-device command slot archive-device drive"
+        echo "  Insufficient number of arguments arguments given."
+        echo "  Mimimum usage is first three arguments ..."
+        exit 1
      fi
      ;;
 esac
@@ -109,9 +109,9 @@ case $cmd in
       #mt -f $device offline
       mt -f $device rewoffl
       if test x$slot = x; then
-        ${MTX} -f $ctl unload
+         ${MTX} -f $ctl unload
       else
-        ${MTX} -f $ctl unload $slot $drive
+         ${MTX} -f $ctl unload $slot $drive
       fi
       ;;
 
index 7c254d35461a08ad1b8bf101a2b4816f6a7842fb..58e8ad1d3ac6cdda867504a4dbf948f1b0f3ea5b 100644 (file)
@@ -4,8 +4,12 @@
 General:
 
 Changes to 1.39.5
+22Feb06
+- Back port changes to 1.38.5
+- Fix recycle SQL for StorageId.
+- Fix misplaced quote in mtx-changer script.
 20Feb06
-- Note!!! Your database must be updated, or you must create 
+- Note. Your database must be updated, or you must create 
   a new database. I have not yet incremented the database level.
 - Add Location table. 
 - Add LocationId, DeviceId, and MediaTypeId to Media record.
@@ -77,7 +81,7 @@ Changes to 1.39.5
 - Fix typo (strcpy->strcmp) in ua_prune.c as reported by Martin.
 - Fix command arg name->volume in label command of gnome-console.
 - Fix SD acquire.c to release correct DCR by explicitly testing
-  on the dcr address rather than trying to "devine" if it is a read
+  on the dcr address rather than trying to devine if it is a read
   or write dcr.  This failed in error conditions when the device was
   not fully setup.
  
index 7181c60f2d0d6158f154f4d0c3894cd262fcccc4..c66799b50e0e8b13e8aeaee71b5a4ee1c1936c8c 100644 (file)
@@ -6,7 +6,7 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/disk-changer" %c %o %S %a %d
+#  Changer Command = "path-to-this-script/disk-changer %c %o %S %a %d"
 #    you will have the following input to this script:
 #
 #  So Bacula will always call with all the following arguments, even though
index 41498ef89e9a3efbcf0d01a2686f9e5cda35fb39..48eccb8a788b003e1e8aa7316caa7fad10da4b2a 100644 (file)
@@ -6,7 +6,7 @@
 #
 #  If you set in your Device resource
 #
-#  Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a %d
+#  Changer Command = "path-to-this-script/mtx-changer %c %o %S %a %d"
 #    you will have the following input to this script:
 #
 #  So Bacula will always call with all the following arguments, even though
index 048de8fd428ccf5e894f086efee77f0a6d734bff..641a1e77007f98aa913bfc76ee4b7c559d90cced 100644 (file)
@@ -10,7 +10,7 @@
  *    Version $Id$
  */
 /*
-   Copyright (C) 2000-2005 Kern Sibbald
+   Copyright (C) 2000-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
index 11241990ff5d3241188ac78606e90a0f1361478c..dddff5be556f348bc6e6d3ef3e1983a7aa12bf03 100644 (file)
@@ -77,8 +77,8 @@ int recycle_oldest_purged_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
    oldest.MediaId = 0;
    if (InChanger) {
       char changer[100];
-      bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s",
-         edit_uint64(mr->StorageId, ed1));
+      bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
+         edit_int64(mr->StorageId, ed1));
       Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, changer);
    } else {
       Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, "");