Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

shell script backup system

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
mmorenopc



Joined: Tue May 31, 2005 5:41 pm
Posts: 1

PostPosted: Tue May 31, 2005 5:49 pm    Post subject: shell script backup system Reply with quote

Hi all!!, I have being trying an script I found in a magazine to put in place a simple way to incrementaly backup files in a directory, i have tryied all sort of combination but the error persist, is something with xargs but i can see it


the script is:

find /home/office/ -newer /home/backup/office-backup-`date -I -d yesterday`.tgz \! -type d | xargs tar -zcvf /home/malcolm/office-date -I.tgz

And for more than i check what coung be wrong I can't see it and i get this error message

Any idea what migh be wrong ?

xargs: unmatched single quote


Thanks a lot a the force be with you !!
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8464
Location: Warrington, UK

PostPosted: Tue May 31, 2005 7:56 pm    Post subject: RE: shell script backup system Reply with quote

Try this

Code:

find /home/office/ -newer /home/backup/office-backup-$(date -I -d yesterday).tgz \! -type d | xargs tar -zcvf /home/malcolm/office-$(date -I).tgz


$() is more readable than backticks, once you switch to those, you see you left them out of the archive name.

This will work provided none of your filenames include spaces, or any other shell reserved characters. xargs falls over on those. A more robust solution would be

Code:

find /home/office/ -newer /home/backup/office-backup-$date -I -d yesterday).tgz \! -type d -exec tar -cf /home/malcolm/office-$(date -I).tar "{}" \;
gzip /home/malcolm/office-$(date -I).tar

_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast