1 #!/bin/sh 2 # Use this with -F from tar and -H with afio to change the backup device. 3 4 #Script provided by Raphael Manfredi <Raphael_Manfredi@pobox.com>. 5 6 vol="$1" 7 device="$2" 8 message="$3" 9 10 # debugging -- show error message to ensure it was a "no space left" 11 case "$message" in 12 '') ;; 13 *) echo "Got error '$message'";; 14 esac 15 16 case "$device" in 17 /dev/tape|/dev/ntape) 18 medium=tape 19 echo -n "Ejecting tape..." 20 mt -f$device offline 21 echo "done." 22 ;; 23 /dev/floppy) 24 medium="floppy disk" 25 ;; 26 *) 27 echo "Unrecognized medium device!" 28 medium="backup medium" 29 ;; 30 esac 31 32 cont=true 33 while $cont; do 34 echo "Please insert $medium for volume #$vol..." 35 echo -n "Press \"return\" when $medium is ready, or enter \"q\" to quit: 36 ^G" 37 read ans 38 case "$ans" in 39 q*) exit 1;; 40 esac 41 case "$medium" in 42 tape) 43 mt -f$device status >/dev/null 2>&1 44 case "$?" in 45 0) cont=false;; 46 *) echo "Tape status error.";; 47 esac 48 ;; 49 *) 50 cont=false 51 esac 52 done