Results 1 to 3 of 3

Thread: command in bash script to check if tar is currupt or not

  1. #1

    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
    send the file
    send an e-mail reporting a failure


  2. #2
    Join Date
    Oct 2005
    You can use the return value of 'tar'.
    The following code is from a Perl script that performs this type of error check:

    $state = `tar -zcvf ./$name.tgz $dir > ./$name.log 2>&1`;
    if (! $state) { `cp ./$name.tgz $target`; }
    else { printf ("Warning: tar returned error code %d!\n", $state); }

    Just adapt that to the 'bash' syntax.

  3. #3
    do 1 thng.....
    check if the compression is done or not, and if done ,by how many percentage
    thn open the file not by cat to see if the compression is successful or not

Similar Threads

  1. Script to check new email
    By kasparovcom in forum Linux - General Topics
    Replies: 1
    Last Post: 11-21-2011, 07:38 PM
  2. script to check log file....
    By boblucci in forum Programming
    Replies: 3
    Last Post: 11-20-2003, 07:19 AM
  3. Bash :: Command recursion to a directories' contents
    By Schotty in forum Linux - Software, Applications & Programming
    Replies: 7
    Last Post: 01-27-2003, 07:31 PM
  4. bash command for 'ipconfig' equivalent?
    By Phaete in forum Linux - Hardware, Networking & Security
    Replies: 5
    Last Post: 05-26-2002, 05:58 AM
  5. Help with bash script
    By tolstoy in forum Programming
    Replies: 5
    Last Post: 05-21-2002, 11:17 AM


Posting Permissions

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