HOWTO verify tarball corruption
# tar cpf archive.tar archive/
# tar Wdf archive.tar
tar -W or tar --verify checks the tar archive with the filesystem dir
The errors are redirected on stderr ( 2> tar_error.txt )
# gzip archive.tar
# gzip -tvv archive.tar.gz
or
# bzip2 archive.tar
# bzip2 -tvv archive.tar.bz2
output is redirected to stderr (even if the test is successful) and is similar to
archive.tar.bz2: OK
You can test it redirecting the output to a file $TEST and then using
if [ "$(awk '{print $2}' $TEST)" != "OK" ]; then
#manage error
exit
else
...
fi

0 Comments:
Post a Comment
<< Home