Results 1 to 5 of 5
As part of my script I need to compress a 50Gb file. but I need to check that the compressed is not corrupt if it is ok it will then ...
- 01-20-2011 #1Just Joined!
- Join Date
- Jan 2011
- Posts
- 19
command in bash script to check if tar is currupt or not
As part of my script I need to compress a 50Gb file. but I need to check that the compressed is not corrupt if it is ok it will then send it over if not it will report an error. I really don't have a clue how how to achieve that could some help please
cd /home/ops/Desktop/temp
tar czvf backup-"$(date +%d-%b-%y)".tgz /home/ops/Desktop/temp
I need some here to check the compress file then somelike if the file is
if
send the file
else
send an e-mail reporting a failure
Thanks
Tom
- 01-20-2011 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
What is your criteria for whether the file is "corrupt" or not....?
- 01-20-2011 #3Just Joined!
- Join Date
- Jan 2011
- Posts
- 19
- 01-21-2011 #4Just Joined!
- Join Date
- Mar 2009
- Location
- Norway
- Posts
- 52
Have you looked at the return-values from tar after you've created the archive?
Also, tar -W attempts to verify the arcive after you've created it, so if you can run the test at the same time you create it, that should do the trick.
otherwise you have to resort to checksumming (sha1, md5 or something). either way, for a 50GB file that you are going to ship between machines, checksumming is a good habit
Henrik
- 01-26-2011 #5Just Joined!
- Join Date
- Mar 2010
- Posts
- 5
Or you can use a tool that's designed to perform checksum verifications automatically and is faster than tar....BRU.
When performing a verification with BRU, it automatically performs 32-bit checksum verification based on data that it's put into the archive of what the file's original checksum value was prior to being backed up.
Just a suggestion if you're doing something such as relying on tar for your archived data.


Reply With Quote
