#
# 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"
;;
loaded)
- ${MTX} -f $ctl status >/tmp/mtx.$$
+ tempfile=`mktemp -t` || exit 33
+ ${MTX} -f $ctl status > $tempfile
rtn=$?
- cat /tmp/mtx.$$ | grep "^Data Transfer Element $drive:Full" | awk '{print $7}'
- cat /tmp/mtx.$$ | grep "^Data Transfer Element $drive:Empty" | awk '{print 0}'
- rm -f /tmp/mtx.$$
+ cat $tempfile | grep "^Data Transfer Element $drive:Full" | awk '{print $7}'
+ cat $tempfile | grep "^Data Transfer Element $drive:Empty" | awk '{print 0}'
+ rm -f $tempfile
exit $rtn
;;