]> git.sur5r.net Git - bacula/bacula/blob - bacula/examples/autochangers/mtx-changer.Adic-Scalar-24
16577cd6059fb516b8d6cadbb53b27876e07b098
[bacula/bacula] / bacula / examples / autochangers / mtx-changer.Adic-Scalar-24
1 #!/bin/sh
2 #
3 # Bacula interface to mtx autoloader
4 #
5 #  mtx-changer "changer-device" "command" "slot"
6 #
7 #   Modified for Adic Scalar 24 with one LTO drive by
8 #      M. Ludovic Strappozon
9 #
10 case "$2" in 
11    unload)
12 #     echo "Doing mtx -f $1 $2"
13       mtx -f $1 $2
14       ;;
15
16    load)
17 #     echo "Doing mtx -f $1 $2 $3"
18       mtx -f $1 $2 $3
19       sleep 20
20       ;;
21
22    list) 
23 #     echo "Requested list"
24 #     mtx -f $1 status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3}" | sed "s/:.*$/ /g" | tr -d "[\r\n]"
25       mtx -f $1 status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//"
26       ;;
27
28    loaded)
29 #     echo "Request loaded"
30       mtx -f $1 status >/tmp/mtx.$$
31       cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print \$7}"
32       cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Empty" | awk "{print 0}"
33       rm -f /tmp/mtx.$$
34       ;;
35
36    slots)
37 #     echo "Request slots"
38       mtx -f $1 status | grep " *Storage Changer" | awk "{print \$5}"
39       ;;
40 esac