LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-07-2006, 04:28 AM   #1
venki
Member
 
Registered: Sep 2006
Location: India
Distribution: suse10.2
Posts: 128

Rep: Reputation: 15
log probelm in backup


Hi all,

i wrote a script for incremental backup..here is the script..

echo "Starting changes backup..."
cd /home/nagesh/

tar -czvf /home/nagesh/`date +"%d-%m-%y"`_changes.tar.gz --after-date="`date +%F --newer='yesterday'`" sri/* \
laxmi/* > log_backup.log

echo "Changes backup complete."


there are 100's of subfolders in laxmi...

i din't change even a single file ..but all folders are coming in tar file ...

and anothere thing is in log_backup.log it is showing all folders...

plz help me...it has to show only the folder which i have changed ...

script is working well..plz help me

thks a lot...
 
Old 12-07-2006, 05:01 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
tar -czvf /home/nagesh/`date +"%d-%m-%y"`_changes.tar.gz --after-date="`date +%F --newer='yesterday'`" sri/* \
laxmi/* > log_backup.log
You're redirecting all output to log_backup.log so that's working correctly. The "problem" is that every directory gets tar'ed (by the way, if the amount of backup data is big, there are better alternatives than tar).

I also see you're using both "--after-date" and "--newer". No need for that:

Quoted from man tar
Quote:
-N, --after-date DATE, --newer DATE
only store files newer than DATE
It means that "-N" is exactly the same as "--after-date" which is exactly the same as "--newer". Only use one of those. It's probably up to how you define the DATE, i.e. newer than what should be backed up (is "yesterday" good format?).

Probably tar doesn't understand the format you're trying to give it, and doesn't care about the "newer than" -thing, thus backing up everything. So, newer than what are you trying to backup? Running that script every day, backing up only data that has changed since yesterday? In that case you'll need to figure out how to tell that in date format, and use that.

Try this and tell me if it works; I haven't tried it out, just wrote from what I think I remember about using date in scripts (it's just your codepiece, modified a bit):
Code:
tar -czvf /home/nagesh/$(date -d yesterday)_changes.tar.gz --after-date="$(date -d yesterday)" sri/* laxmi/* > log_backup.log
 
Old 12-07-2006, 07:06 AM   #3
venki
Member
 
Registered: Sep 2006
Location: India
Distribution: suse10.2
Posts: 128

Original Poster
Rep: Reputation: 15
Thks a lot for quick reply .. but when i executed the above script...
tar -czvf /home/nagesh/$(date -d yesterday)_changes.tar.gz --after-date="$(date -d yesterday)" sri/* laxmi/* > log_backup.log:-----

tar: Dec: Cannot stat: No such file or directory
tar: 6: Cannot stat: No such file or directory
tar: 16\:26\:37: Cannot stat: No such file or directory
tar: IST: Cannot stat: No such file or directory
tar: 2006_changes.tar.gz: Cannot stat: No such file or directory
tar: --after-date=Wed Dec 6 16\:26\:37 IST 2006: Cannot stat: No such file or directory
tar: sri/*: Cannot stat: No such file or directory
tar: laxmi/*: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors
........................................................

But whn i executed my script ...

date: unrecognized option `--newer=yesterday'
Try `date --help' for more information.
tar: Treating date `' as 2006-12-07 00:00:00 + 0 nanoseconds
tar: sri/*: Cannot stat: No such file or directory
tar: laxmi/*: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors..
...................................................

what shld i do sir....is it that much tough.....what u said is 100% correct ...it is not recognizing yesterday....

plz help me...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Replicate Log Backup? filex Linux - Software 3 09-14-2006 06:31 AM
Opennms Logs - where are web.log, web_rtc.log and webauth.log referenced? not_much_of_a_guru Linux - Networking 0 07-12-2006 11:28 AM
wusb11 probelm RockyB Linux - Wireless Networking 3 01-20-2005 02:58 AM
Probelm with sound yigal Mandriva 5 10-04-2004 09:54 PM
Tar Backup Log bally Linux - General 2 04-14-2004 01:24 AM


All times are GMT -5. The time now is 10:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration