Jay Lessert wrote:
#!/bin/sh
mt -f /dev/nrsa1 rewind
mt -f /dev/nrsa0 rewind
filenum=0
while true ; do
echo copying tape file number $filenum
dd bs=32k if=/dev/nrsa1 of=/dev/nrsa0 || exit
filenum=`expr $filenum + 1`
done
I assume dd will return fail status when /dev/nrsa1 hits EOM, but
I've not tested that; keep an eye on it. IIRC, your total number
of files should be #DLEs + 2.
Yes, dd will return "fail" when /dev/nrsa1 hits EOM, but also when
/dev/nrsa0 (your output tape) has a write error (basically there is
no much difference between End-Of-Media and a write error).
Somehow you have to check if you got hit by an error on which tape
device, be it by first counting the files on tape /dev/nrsa1,
be it by seperating the reading and the writing, maybe something like:
while :
do {dd ibs=32k if=/dev/nrsa1 || exit} |
{dd obs=32k if=/dev/nrsa0 || echo 'Write error' >&2}
done
Untested -- adding rewind and filenum feedback is up to the user.
Notice the curly braces instead of parenthesis, or 'exit' would only
exit the subshell; this needs a modern shell (bash/ks will do).
--
Paul Bijnens, Xplanation Tel +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512
http://www.xplanation.com/ email: Paul.Bijnens AT xplanation DOT com
***********************************************************************
* I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, *
* kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ... "Are you sure?" ... YES ... Phew ... I'm out *
***********************************************************************
|