#!/sbin/sh touch rawfile # The rawfile might already be there, but just in case while [ 1 -eq 1 ] # Whatever, just do it do size=`ls -l rawfile | awk '{print $5}'` # Speaks for itself blocks=`expr "$size" / 512` # Ditto. 512 was a good blocksize for 4mm DAT. Just be consistent full=`df -k . | grep| awk '{print $6}'` # Unfortunately, this only gets checked once per glitch. Maybe a fork? echo $size # Just so I know how it's going echo $blocks echo $full if [ $full -gt 90 ] then echo "filesystem is filling up" # You get the point here exit 1 fi mt -f /dev/tape rewind # Let's not take chances. Start at the beginning. sleep 60 # The drive hates this tape as it is. Give it a rest. mt -f /dev/rmt/tps1d6nrv fsr $blocks # However big rawfile is already, we can skip that on the tape dd if=/dev/rmt/tps1d6nrv bs=512 >> rawfile # Let's get as much as we can if [ $? -eq 0 ] then # If dd got clipped by a tape error, there's still work to do, echo "dd exited cleanly" # if not, it must have gotten to the end of the file this time exit 0 # without a hitch. We're done. fi done