Hello all...
Been a while since I've posted here, but nice to be back.
I'm writing a C shell script that will write a directory to two tape drives at the same time as part of an archive system (one of the tapes goes offsite, the other stays local).
In the script, I want to get the return code from tar which I know I can do by something like:
Code:
tar -cvf /dev/st0 somedir
if ( $status == 0 ) then
echo "Tape 1 written sucessfully"
else
echo "An error occurred".
endif
However, as I said, I want to write both tapes at once so I need to background the first tar:
Code:
tar -cvf /dev/st0 somedir &
tar -cvf /dev/st1 samedir
Now, how can I get the return code for both runs to make sure both tapes were written sucessfully, and even better, if there was an error, output the actual error from the run?
Any help much appreciated.