> On 26 Sep 2005 09:32:47 -0700, John F.
>> I have written a tarfile to tape and need to read its create date to
>> std out so that I can compare it to the dated of my last good backup
>> (Checking to be sure that I'm not overwriting my latest backup) Sorry
>> for this simplistic question but it's giving me fits for some reason.
>> How can I get the tarfile's create date?
> tar tvf /dev/st0
> When a tar file is written to a device, I'm not sure if there is a time
> stamp for the entire archive. You can grep the "tar tvf" output to look
> for a file that is known to be newer than the previous backup.
Right, a tar archive does not contain a creation date.
You should create a time-stamp file just before you write the tape, and
ensure that this file is among the first files copied to the archive.
If you are backing up the directory /dev (crazy thing to do) tar will
only write a record describing each device node, not back up the contents
of all devices in /dev (thank god). But there is /dev/st0, and it will
have its date continuously changing as the tape is written. So, you
could extract the device node from the tape:
tar tvf /dev/st0 /dev/st0 | command-to-check-the-date-in-the-line
If you are not backing up /dev, you can allways include /dev/st0
as a first object to back up:
tar cf /dev/st0 /dev/st0 directory-to-back-up
(Notice that the device name appears twice, once as an argument to
the f flag, and once as the first object to back up.)
Another simple way to achieve a date is, if to touch the top directory
you are backing up:
tar cf0 /dev/stty directory-to-back-up
Then you only need to read the stat data of the top directory off the
tape, as before:
tar tvf /dev/st0 | head -1 | command-to-check-the-date-in-the-line