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 |
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. |
|
 |
06-06-2006, 08:11 AM
|
#1
|
|
Member
Registered: Dec 2004
Location: Haifa
Distribution: Fedora Core 4, Kubuntu
Posts: 234
Rep:
|
Simple backup script
I've been looking for a backup solution, and I'm not really happy with any software that I see. So I'm trying to find a variant of "cp" that would just copy everything in /home/user/ that has been changed in the past X days to /home/user/backup including hidden files. I would then just burn ~/backup to a CD-R. I can't get a handle on the syntax, though. How is this done?
Thanks.
|
|
|
|
06-06-2006, 08:57 AM
|
#2
|
|
Moderator
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,816
Rep: 
|
Change the -1 mtime option to adjust the modified date. -2 will be two days ago, -3 three days, etc... You'll want to do a fullbackup and
Putting the backup directory under /home/user creates a problem with the find. It's best not to put it there.
Code:
#!/bin/sh
NEWDIR="/tmp/backup"
for i in `find /home/user -type f -mtime -1`; do
DIR=`dirname $i`
DEST=$NEWDIR/$DIR
mkdir -p $DEST
cp -a $i $DEST
done
You may want to look at rsync using the timestamp options, even for local copies. It will be a bit more robust.
|
|
|
|
06-06-2006, 12:22 PM
|
#3
|
|
Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
Use dar. I recommend using DVD instead of CD for backups because DVD disc includes ECC which CD do not have.
As with all backups, you will have to do a full backup so it can compare it to any modified or new files. Also test the backups on another system.
|
|
|
|
06-07-2006, 07:00 PM
|
#4
|
|
Member
Registered: Dec 2004
Location: Haifa
Distribution: Fedora Core 4, Kubuntu
Posts: 234
Original Poster
Rep:
|
Thanks, this is just what I was looking for. I will play with tit a bit and make sure that I understand it in it's entirely.
|
|
|
|
06-07-2006, 10:53 PM
|
#5
|
|
Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
I dislike when people do not or just skim posts. dar is a lot better than using cp or tar. dar can double or triple the size of a CD or DVD because you can set the minimum file size to compress and set which files to not compress. Instead of running scripts, you just specify the .darrc file.
|
|
|
|
06-17-2006, 05:00 AM
|
#6
|
|
Member
Registered: Dec 2004
Location: Haifa
Distribution: Fedora Core 4, Kubuntu
Posts: 234
Original Poster
Rep:
|
Quote:
|
Originally Posted by Electro
I dislike when people do not or just skim posts. dar is a lot better than using cp or tar. dar can double or triple the size of a CD or DVD because you can set the minimum file size to compress and set which files to not compress. Instead of running scripts, you just specify the .darrc file.
|
Well, I'd rather use cp because I want to be able to access the individual files in case of need without restoring the entire backup. Usually, my needs are for only a few files.
|
|
|
|
06-17-2006, 02:59 PM
|
#7
|
|
Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
dar can extract a file if you want to with out extracting the whole file.
|
|
|
|
06-18-2006, 11:53 PM
|
#8
|
|
Member
Registered: Dec 2004
Location: Haifa
Distribution: Fedora Core 4, Kubuntu
Posts: 234
Original Poster
Rep:
|
Quote:
|
Originally Posted by Electro
dar can extract a file if you want to with out extracting the whole file.
|
I just spent some time looking at dar. While it seems an excellent program, for me it is most important that the data be stored in it's original form- only cp does that. If I have a text file, I want it stored as a text file.
Thanks for the suggestion, though.
Dotan Cohen
|
|
|
|
| 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:00 PM.
|
|
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
|
|