Answer the question
In order to leave comments, you need to log in
How do I know if the tar command has completed completely?
Hello everyone, yesterday I archived the folder and left.
In the morning I see that the computer is rebooted, the archive is in place. But there is a doubt, but was it archived to the end?
By the way, the folder weighs 13 GB, and the archive 10, but this is an archive)
So, how can you find out if the server has archived to the end? and in general there are more reliable archivers, so that if the connection is lost, then it will still complete the archive itself
Answer the question
In order to leave comments, you need to log in
Now - probably except to unpack and compare the contents. But it's better to repackage.
The next time you run something like this when creating a large archive:
tar ... && touch success.flag
If the success.flag file is created, then the archiving process was completed successfully
there are more reliable archivers, so that if the connection is lost, it will still complete the archive itself
so that if the connection is lost, it will still complete the archive itself
it is better to register backup of files and folders as a system service.
sudo systemctl start backup_home.service
and let it run.
if on the question, then, as usual, track the exit code upon completion of hf,jns ghjub.
if it is not equal to zero, then it means that there were jambs in the work of tar
man tar gives such options.
RETURN VALUE
Tar exit code indicates whether it was able to successfully perform the requested operation, and if not, what kind of error occurred.
0 Successful termination.
1 Some files differ. If tar was invoked with the --compare (--diff, -d) command line option, this means that some files in the archive differ from their disk counterparts. If tar was given one of the --create, --append or --update options, this exit code means that some files were changed while being archived and so the resulting archive does not contain the exact copy of the file set.
2 Fatal error. This means that some fatal, unrecoverable error occurred.
If a subprocess that had been invoked by tar exited with a nonzero exit code, tar itself exits with that code as well. This can happen, for example, if a compression option (e.g. -z) was used and the external compressor program failed. Another example is rmt failure during backup to a remote device.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question