The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. February 12, 2012, 07:05:40 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: using rsync and find command to backup files 24 hours ago ?  (Read 2602 times)
nubie
Rookie
**
Offline Offline

Posts: 28


View Profile
« on: December 20, 2009, 08:47:54 PM »

Hi all, need help please, i want to configure server to backup data using rsync and command find to backup just a new file/edit file by user.
i've been trying this command to do that:
Code:
find /resource/* -mtime 0 -exec rsync -avz '{}' /destination \;
with that command i can backup the exactly file 24 hours ago which new file/edit file by users, the issues is with that command is
/resources/                                   /destination/
/resources/g.xls                             /destination/g.xls
/resources/a/test.txt                      /destination/test.txt
/resources/a/c.txt                         /destination/c.txt
                                                 /destination/a/test.txt
                                                 /destination/a/c.txt

So, you can see above explain above it become double backup file first on top directory on destination backup, and when i add -type f on find command
to just get the file need to backup
Code:
find /resource/* -type f-mtime 0 -exec rsync -avz '{}' /destination \;
it makes the files backup just go on top of destination directory similar like:
/destination/g.xls
/destination/c.txt
/destination/test.txt
it's not make the folder to backup,

and i create some bash script using tar and it's works but the weakness using tar is slowly backup it can eat 8 hours or more time to backup.

Need help/advice please, what i need is backup using rsync to get backup just new file/edited file if i using new HDD backup cause if use new HDD Backup
it just eat some space that i have on old hdd backup but i need to backup the path of directory too cause if user complain about missing files i'm not confused to find
that files cause sometimes user forget the file they named it to their files .

Thank's a lot  Smiley

Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #1 on: December 23, 2009, 12:27:02 PM »

I would like to help you, but I'm having a little bit of trouble understanding your post...

Are you saying that find is rsyncing the files twice?
Logged

hai
nubie
Rookie
**
Offline Offline

Posts: 28


View Profile
« Reply #2 on: December 23, 2009, 06:54:54 PM »

Sorry about my post VS Embarrassed, that's not like that, what i need is using rsync and command find to get new edit file for last 24 hours a go but with the directory of files too,
if i try using command find /resources/* -mtime 0 -exec rsync -avz '{}' /destination/ \; it will backup all files for last modification in 24 hours ago but if i have folder again
on directory resources and have some files on there the files will backup too on /resources/files_on_folder_ .

Maybe you could test my command and test it out so it would make clear everything, sorry about my post and my english, please need advice about this.


Thank's a lot.

Regards,
Nubie
Logged
herbacious
Journeyman
***
Offline Offline

Posts: 51


View Profile
« Reply #3 on: January 05, 2010, 06:34:54 AM »

wouldnt it be easier just to let rsync take care of this on its own, its basicaly what its for AFAIK
Logged
nubie
Rookie
**
Offline Offline

Posts: 28


View Profile
« Reply #4 on: January 10, 2010, 06:00:11 PM »

Thank's for your reply herbacious, the problem is not like that right now my hdd backup size is:
 294G - use: 214G - avail:65G
if the HD backup become full i must change the HD with the size HD backup more bigger than the old HD backup, so i'm just thinking to make use rsync with the find command
to find just file/dir last edit/create just for backup to the new HD backup so the files that had been backup to the old one will stay in old HD backup, for my personal opinion, it's more efficient  Embarrassed, correct me if i'm wrong.
I've try this way to do that without rsync but using tar
Code:
#!/bin/bash
yesterday = 'date +%D -date=-1day'
( cd /datasamba/ && tar --create --file=- --newer=$yesterday .) | ( cd /mnt/usb_harddrive/ && tar xvpf - )
with that bash above it's works for me but the main problem using bash above is time, it takes long time.

Need advice please, and sorry just for reply this post today.  Smiley
Logged
qweqwe
Rookie
**
Offline Offline

Posts: 14


View Profile
« Reply #5 on: January 12, 2010, 07:27:34 PM »

<spammer dick go boom>
« Last Edit: January 12, 2010, 08:32:21 PM by nutballs » Logged

No links in signatures please
smile468
n00b
*
Offline Offline

Posts: 1


View Profile
« Reply #6 on: May 20, 2010, 12:27:42 AM »

I'M NOT VERY GOOD AT THE INTERNETS NOR THE SPAMMING THEREOF
« Last Edit: May 20, 2010, 06:30:12 AM by vsloathe » Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 9792



View Profile
« Reply #7 on: May 20, 2010, 05:02:25 PM »

 ROFLMAO
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!