Find the answer to your Linux question:
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 ...
  1. #1
    Just 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

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    What is your criteria for whether the file is "corrupt" or not....?

  3. #3
    Just Joined!
    Join Date
    Jan 2011
    Posts
    19
    Quote Originally Posted by HROAdmin26 View Post
    What is your criteria for whether the file is "corrupt" or not....?
    The criteria would whether the file the tar can be uncompressed or the files inside are corrupt or not something on them lines

  4. #4
    Just Joined!
    Join Date
    Mar 2009
    Location
    Norway
    Posts
    52
    Quote Originally Posted by thomas130 View Post
    The criteria would whether the file the tar can be uncompressed or the files inside are corrupt or not something on them lines
    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

  5. #5
    Just 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...