Added tape check

This commit is contained in:
Jack-Benny Persson 2012-02-24 22:31:51 +01:00
parent c8ba838f3a
commit e656cb33f6

View File

@ -35,17 +35,18 @@ Check_tape()
TESTTAPE=`mt -f ${DRIVE} status | grep DR_OPEN` TESTTAPE=`mt -f ${DRIVE} status | grep DR_OPEN`
if [ $? == 0 ]; then if [ $? == 0 ]; then
echo "No tape in drive, aborting" echo "No tape in drive, aborting"
exit 1 EXIT_STATE=1
else else
echo "Tape seems to exist" echo "Tape seems to exist"
exit 0 EXIT_STATE=0
fi fi
} }
### Main routine ### ### Main routine ###
# Check and repeat until the tape drive is on
EXIT_STATE=3 EXIT_STATE=3
while [ ${EXIT_STATE} != 0 ]; do while [ ${EXIT_STATE} != 0 ]; do
Check_drive Check_drive
@ -53,3 +54,12 @@ while [ ${EXIT_STATE} != 0 ]; do
sleep 20 sleep 20
fi fi
done done
# Check and repeat until a tape is inserted
EXIT_STATE=3
while [ ${EXIT_STATE} != 0 ]; do
Check_tape
if [ ${EXIT_STATE} != 0 ]; then
sleep 20
fi
done