Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-18-2004, 10:20 PM
|
#1
|
|
Senior Member
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040
Rep:
|
Getting date format right in tar incremental backup
I'm trying to learn to do both full and incremental tar backups. Here is the full backup script I wrote, after studying some examples here and there:
----------------------------------------------------------
#!/bin/sh
LASTFULL=`date +%F% %T`
echo $LASTFULL > /store_1/tar_bkp/last_full_backup_date
tar -c -v -z -f /store_1/tar_bkp/full_backup.tgz /home/jon/Documents
----------------------------------------------------------
That works just fine. Then I tried an incremental-backup script, here:
----------------------------------------------------------
#!/bin/sh
LASTFULL="`cat /store_1/tar_bkp/last_full_backup_date`"
tar -c --newer $LASTFULL -v -z -f /store_1/tar_bkp/incremented_backup.tgz /home/jon/Documents
echo $LASTFULL
-----------------------------------------------------------
and no matter what date format I try (referring to the GNU tar webpage for acceptable formats, and also trying some that turned out no good), the result is always a full backup
just like the first script produces, within a few bytes. (I'm experimenting with just one large directory to save time, and later I will backup all my files.)
What date format do I need to specify the year, month, day, hour, minute, and second?
And why, when I experiment with a supposedly OK date format, does the result still equal
a full backup?
Many thanks in advance.
|
|
|
|
08-19-2004, 12:12 AM
|
#2
|
|
Senior Member
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577
Rep:
|
|
|
|
|
08-19-2004, 09:02 AM
|
#3
|
|
Senior Member
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040
Original Poster
Rep:
|
Thanks, 320mb. I saved that page for further study.
However, unless I'm missing something in reading it, it doesn't address the incremental backup property that's stumping me. My full backup works fine. But the ones with the incremental switch "N" (I also tried --newer and --after-date with same result) also produce, not incremental (smaller) tar files, but the same full-sized one as without the switch. Even when the date format seems to be OK for tar. I can only guess I'm doing something wrong when I specify the date. But I've re-read the manual and GNU website pages several times and can't see where I'm going wrong.
|
|
|
|
08-19-2004, 09:53 AM
|
#4
|
|
Senior Member
Registered: Jan 2003
Location: Kansas City, Missouri, USA
Distribution: Ubuntu
Posts: 1,040
Original Poster
Rep:
|
Quote:
Originally posted by jonr
But I've re-read the manual and GNU website pages several times and can't see where I'm going wrong.
|
OK, I got the date format to work, and the incremental backup to be just that.
What I needed was a backslash to put a literal space in the date. The manual probably assumes every reader knows that and doesn't mention it. (This kind of assumption is REALLY common...)
So it turns out the date-file creation that works, in the form I wanted it, goes:
LASTFULL=`date +%F\ %T`
Unfortunately (or not), in the process of getting to this point, I also read that it's not recommended to make incremental backups this way! Sometimes certain files are not detected etc.
Back to the drawing board. At least I know how to specify dates for tar now.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:28 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|