pkgsrc/sysutils/bacula/files/chio-changer
adam cc98df446d Changes 5.0.1:
* We believe that we have resolved most of the problems
  concerning canceled or failed jobs being "stuck" in the
  Director.  There is one outstanding problem in the SD when
  canceling jobs that we will fix in the next major release.
  If you see jobs that seem to be stuck, in general issuing
  a cancel command in bconsole should now make them go away.

Directives:
* The default for "Allow Duplicate Jobs" has been changed from
  no to yes.  If you use this directive, please check your
  conf file, and note the next two items!
* AllowHigherDuplicates disabled. It did not work as documented
    and was confusing.
* New directive "CancelLowerLevelDuplicates" See New Features
  section in the manual.
* Truncate on Purge rewritten.  See New Features section in the manual.

* Bug fixes

* Ensure SD asks for help when looping even if poll set.
* Fix three-pool regress bug
* This version fixes an issue where the console window would start out
  docked. It is fixed by initiating the variables in the Pages class wi
  constructor.
* Fix make_catalog_backup.pl fails when catalog db is on other host
2010-03-09 07:06:00 +00:00

97 lines
2.1 KiB
Bash
Executable file

#!/bin/sh
#
# Bacula interface to chio autoloader
#
# If you set in your Device resource
#
# Changer Command = "path-to-this-script/chio-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
# in come cases, not all are used.
#
# chio-changer "changer-device" "command" "slot" "archive-device" "drive-index"
# $1 $2 $3 $4 $5
#
# N.B. If you change the script, take care to return either
# the chio exit code or a 0. If the script exits with a non-zero
# exit code, Bacula will assume the request failed.
CHIO=/bin/chio
# check parameter count on commandline
check_parm_count() {
pCount=$1
pCountNeed=$2
if test $pCount -lt $pCountNeed; then
echo "usage: chio-changer ctl-device command [slot archive-device drive-index]"
echo " Insufficient number of arguments given."
if test $pCount -lt 2; then
echo " Mimimum usage is first two arguments ..."
else
echo " Command expected $pCountNeed arguments"
fi
exit 1
fi
}
# Check for special cases where only 2 arguments are needed,
# all others are a minimum of 5
case $2 in
list|listall)
check_parm_count $# 2
;;
slots)
check_parm_count $# 2
;;
transfer)
check_parm_count $# 4
;;
*)
check_parm_count $# 5
;;
esac
# Setup arguments
ctl=$1
cmd="$2"
slot=$3
device=$4
drive=$5
case $cmd in
unload)
${CHIO} -f $ctl move drive $drive slot $slot
;;
load)
${CHIO} -f $ctl move slot $slot drive $drive
;;
list)
${CHIO} -f $ctl status slot voltags | /usr/bin/awk "/</ { slot=\$2 }\
/Primary volume tag:/ { tag=\$4 }\
/From:/ { print slot tag }"
;;
listall)
echo "Not yet implemented"
;;
loaded)
${CHIO} -f $ctl status drive $drive | /usr/bin/awk "BEGIN { from=0 }\
/From:/{ from=\$3 }\
END { print from }"
;;
slots)
${CHIO} -f $ctl params | awk "/slots/{print \$2}"
;;
transfer)
${CHIO} -f $ctl move slot $slot slot $device
;;
esac
sleep 1