Tar archive wrong creation date

0

I have a script to backup some directories:

tar cjf /backup-`date +\%m-\%d-\%Y`.tar.bz2 mydir >> /dev/null 2>&1

At the end of the process, a "ls -al" show something like:

-rwxr-xr-x 1 my my    719110144 May 29  2000 backup-08-02-2013.tar.bz2

Notice the year: 2000. Archive was made in 2013… What's the problem and how to solve it?

Thanks for your help.

Greg

Posted 2013-08-29T22:08:23.637

Reputation: 3

Have you checked the date & time of the computer (using date)? :-) – Cristian Ciupitu – 2013-08-30T00:21:10.573

@CristianCiupitu: The filename tells us the output from date +%m-%d-%Y. – Scott – 2013-08-30T01:20:44.200

Answers

1

If your archive is being written to a network file system (like NFS or AFS), then make sure the file server has the right date set, as the timestamp of the newly-created file will be determined by the file server's clock. If you can't fix things on the server side, then you'll most likely have to correct the timestamp manually after file creation.

jjlin

Posted 2013-08-29T22:08:23.637

Reputation: 12 964