From e656cb33f6f924078458d2395b7cf028287ab457 Mon Sep 17 00:00:00 2001 From: Jack-Benny Persson Date: Fri, 24 Feb 2012 22:31:51 +0100 Subject: [PATCH] Added tape check --- autotape.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/autotape.sh b/autotape.sh index 04dc215..28db7c7 100755 --- a/autotape.sh +++ b/autotape.sh @@ -35,17 +35,18 @@ Check_tape() TESTTAPE=`mt -f ${DRIVE} status | grep DR_OPEN` if [ $? == 0 ]; then echo "No tape in drive, aborting" - exit 1 + EXIT_STATE=1 else echo "Tape seems to exist" - exit 0 + EXIT_STATE=0 fi } ### Main routine ### +# Check and repeat until the tape drive is on EXIT_STATE=3 while [ ${EXIT_STATE} != 0 ]; do Check_drive @@ -53,3 +54,12 @@ while [ ${EXIT_STATE} != 0 ]; do sleep 20 fi 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