tar: Exiting with failure status due to previous errors
I have written a little script that tars and compresses a list of directories + files.
The script appears to run succesfully, in that a useable .tar.gz file is created after the script runs.
However, I get this annoying message after the script finishes:
tar: Exiting with failure status due to previous errors
I do not see any error messages whilst the script is working, and like I said, the produced file can be uncompressed with no warnings/errors. Since I am using this as part of my backup, I want to make sure that I am not ignoring something serious.
What are the possible reasons that this error/warning message is being produced - and can I safely ignore it?. If I cant ignore it, what are the steps to diagnose and resolve the error?
I am running on Ubuntu 10.0.4
You will get that message if, for any reason, tar can't add all of the specified files to the tar. One if the most common is not having read permission on one of the files. This could be a big problem since you are using this for backup. If you are using the -v
flag, try leaving it off. This should reduce the output and let you see what is going on.
The problem is the f
argument. It takes the next value as the filename, so it must be the last argument:
tar cvzf output.tgz folder
or:
tar -cvzf output.tgz folder
These are both the same and don't produce an error.