LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   backup script question (https://www.linuxquestions.org/questions/linux-software-2/backup-script-question-313583/)

lordofring 04-15-2005 12:08 PM

backup script question
 
Hello,

I have an incremental backup script for my linux box. I used "find -mtime 1" to find all of files accessed on today. But the result is huge. If a file name is changed, the directory is returned. So the whole directory is backed up. At the end, the size is too big for me to backup everyday.

So I modified a little to "find -mtime 1 -type f". The return is much smaller since it only return the files changed on today. But it bring me another problem. If I changed a directory's name like "mv dir1 dir2", nothing will be backup because no file is changed. It will cause my problem when I resotre it in the emergency case.

Anyone could give me some hint to accomplish these two goals together?

thanks

tangle 04-15-2005 12:23 PM

When I get home I'll post the find command and how to get tar to backup the files. I do not have the info onhand right now, sorry.

abhijeetudas 04-15-2005 12:37 PM

Hi,

Im need to do incremental backups too..
could u paste the script u use so i can use
the script too..

Madd_hatter 04-15-2005 01:26 PM

Not to say there's not a way to fix your script, I have no idea. But have you looked into partimage? It's a linux backup utility that does incremental backups. I haven't personally used it but I was looking into it and I think it might suit your needs nicely.

tangle 04-15-2005 09:29 PM

Sorry for the late post.

The find command you need is:
find / -mtime -1 \! -type d -print > /tmp/filelist.daily

This will find all files accessed in the last 24 hours and print the list to the file /tmp/filelist.daily.

To get tar to read the list and archive the files:
tar -cv -T /tmp/filelist.daily -f /mnt/share

This will create the tarball in the /mnt/share directory.

lordofring 04-16-2005 06:59 AM

Thanks tangle. I will try it on Monday.

lordofring 04-18-2005 10:19 AM

Hello,

After I run "find / -mtime -1 /! -type d ", I will get the all files that changed in 24 hours. It does not solve my problem. My problem is that if a directory only changed name by "mv", the super-directory's last modified time is changed and so the whoe super-directory is backed up. I do not want to waste space. (I only want to backup the directory with the new name.)

Thank you the reply.

tangle 04-18-2005 10:25 AM

Sorry, I mis read the post. I believe that you can use the touch command to change the access time for files and directories.

http://www.computerhope.com/unix/utouch.htm

Then all you have to do is touch the directory and/or files after you move them.


All times are GMT -5. The time now is 09:47 PM.