#
# 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"
#
# 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"
#
# 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"
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
#
# 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"
#
# 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"
#
# 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"
esac
--------------050209030507060501040304--
-
#
# 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:
#
;;
*)
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
#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
;;
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.
- 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.
#
# 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
#
# 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
* 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
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, "");