3 # Bacula interface to mtx autoloader
7 # If you set in your Device resource
9 # Changer Command = "path-to-this-script/mtx-changer" %c %o %S %a
10 # you will have the following input to this script:
12 # mtx-changer "changer-device" "command" "slot" "archive-device"
16 # mtx-changer /dev/sg0 load 1 /dev/nst0 (on a Linux system)
18 # If you need to to an offline, refer to the drive as $4
19 # e.g. mt -f $f offline
21 # Many changers need an offline after the unload. Also many
22 # changers need a sleep 60 after the mtx load.
24 # N.B. If you change the script, take care to return either
25 # the mtx exit code or a 0. If the script exits with a non-zero
26 # exit code, Bacula will assume the request failed.
33 # echo "Doing mtx -f $1 unload"
35 # enable the following line if you need to eject the cartridge
41 # echo "Doing mtx -f $1 load $3"
45 # Increase the sleep time if you have a slow device
51 # echo "Requested list"
52 ${MTX} -f $1 status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
56 # echo "Request loaded"
57 ${MTX} -f $1 status >/tmp/mtx.$$
59 cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print \$7}"
60 cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Empty" | awk "{print 0}"
66 # echo "Request slots"
67 ${MTX} -f $1 status | grep " *Storage Changer" | awk "{print \$5}"