Checking tarfile's created date from tape?

Checking tarfile's created date from tape?

Post by John F » Wed, 28 Sep 2005 01:32:47



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?

This very broken example shows what I'm *trying* to do...
tar -xf0 /dev/st0 | stat %y | grep Modify

Thanks
JF

 
 
 

Checking tarfile's created date from tape?

Post by Bill Marcu » Wed, 28 Sep 2005 02:50:12


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.

--
"In matrimony, to hesitate is sometimes to be saved."
-- Butler

 
 
 

Checking tarfile's created date from tape?

Post by Enrique Perez-Terro » Wed, 28 Sep 2005 07:11:01



> 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:

    touch directory-to-back-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

-Enrique

 
 
 

1. How to check file size and create date < 24hr?

I need write a shell script on SUN Solaris 8.  the script will check following:

    1. file exist (e.g. /tmp/file1)
    2. file create date or modify date < 24 hr (e.g. /tmp/file1 <24hr)
    3. file size > 10MB  (e.g. size /tmp/file1 >10MB)

Does anyone have ideal on it?

Thanks.

2. Linux smail

3. Calculating yesterday's date using GNU 'date' (was Re: Require a script)

4. how to make man NOT quit when reached bottom?

5. To check date of Backup from tape.

6. fix scsi/aha15*.c for 2.5.60

7. [Fwd: To check date of Backup from tape.]

8. VIdeo Capture

9. Tarfiles on tape

10. grep using date problem (fgrep `date '+%D'` ~/.diary)?

11. Help : Check if today's date is in a file

12. Creating log file with today's date (newbie alert!)

13. C or PERL to create & check file's CRC