1843966 Members
2090 Online
110226 Solutions
New Discussion

Scripting question

 
SOLVED
Go to solution
Duffs
Regular Advisor

Scripting question

Hi,

I am having a problem with a backup script (see attached doc) on Linux RH AS3.1.

The script attempts to back up the entire system but constantly completes with an error message (2).

However when I run the exact same script but only tarring up a few dir's I don't receieve any error messages.

All advise is welcome.

Rgds,
Dermot
6 REPLIES 6
Peter Godron
Honored Contributor

Re: Scripting question

Dermot,
can you please find out what the actual return code value is i.e. echo $ERRORCODE

It may be a warning that the /bin/tar executable or other file is in use and can't be backed up.

Check thread 141729 for some clues as to the possible causes of the various codes.
Let us know if this is resolved.

Duffs
Regular Advisor

Re: Scripting question

It appears like tar doesn't like certain files that exist within /var. I have now tarred up all the dir's without a problem however /var which is 852Mb ends with the following error:

var/webmin/sessiondb.pag
var/webmin/sessiondb.dir
var/webmin/miniserv.log
var/webmin/webmin.log
/bin/tar: Error exit delayed from previous errors
+ ERRORCODE=2
+ sync
+ sleep 3
+ echo Tar Complete
Tar Complete
+ '[' '!' 2 == 0 ']'
+ echo 'Error(2)' with backup full weekly on COVCACHE
+ mail -s 'IMPORTANT NOTIFICATION' dermot.duffy@walshwestern.com

Big points for any takers.

Rgds,
D
Dave Falloon
Trusted Contributor
Solution

Re: Scripting question

Dermot, you could try adding this option to tar:

( pulled from debian: man tar )

--ignore-failed-read
don't exit with non-zero status on unreadable files

If the file is locked by another process tar will still fail to archive it but it won't tank your backup.

--Dave
Clothes make the man, Naked people have little to no effect on society
Dave Falloon
Trusted Contributor

Re: Scripting question

I forgot to add, if you are still running on an old filesystem for some reason ( if you felt it necessary to run on ext2? ) there is a file size limit of two gigs so tar would fail to write to the archive after two gigs. Probably not the issue in your case, though.

I haven't run redhat for a while, but I'm sure it has a version of star. I like to think it stands for Super TAR, but its probably named after the author. It has a lot of more flexibility if you wanted to extend your backup to do differential archives.

Clothes make the man, Naked people have little to no effect on society
Peter Godron
Honored Contributor

Re: Scripting question

Dermot,
the most common causes for return code 2 are:
directory checksum error
Tar: tape write error
I am suprised that there were no "previous errors" logged.
Can you check the intergity of the backup, as this may all still leave you with a valid backup (less temporary files).
Thanks
Duffs
Regular Advisor

Re: Scripting question

Cheers Dave, That did it!

The '--ignore-failed-read' option is what was missing, and once added to the tar cmd returned an error code of zero which is good.

Thanks again,
D