# 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:
#
wait_for_drive() {
while ! mt -f $1 status >/dev/null 2>/dev/null; do
-# echo "Device $1 - not ready, retrying..."
- sleep 5
+# echo "Device $1 - not ready, retrying..."
+ sleep 5
done
}
changer_unlock() {
LOCKPID="`cat $LOCKFILE 2>/dev/null`"
if [ "$LOCKPID" != $$ ]; then
- echo "$0: Invalid lock file (${LOCKFILE}) - not owned by us!"
- exit 1
+ echo "$0: Invalid lock file (${LOCKFILE}) - not owned by us!"
+ exit 1
fi
+ rm -f $LOCKFILE
}
;;
*)
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
# enable the following line if you need to eject the cartridge
mt -f $device offline
if test x$slot = x; then
- ${MTX} -f $ctl unload
- rtn=$?
+ ${MTX} -f $ctl unload
+ rtn=$?
else
- ${MTX} -f $ctl unload $slot $drive
- rtn=$?
+ ${MTX} -f $ctl unload $slot $drive
+ rtn=$?
fi
;;