hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : second time to run rsync?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

second time to run rsync?

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-08-2007, 03:15 PM
surfmanjoe surfmanjoe is offline
Web Hosting Guru
 
Join Date: Sep 2002
Posts: 262

second time to run rsync?


one day later, if I run the following command again, the command is same as the one run by the first time.

rsync -avz username@IP:/home/asite/public_html/ /home/asite/public_html/

does it mean rsync will just check and copy the newer folders and files from the last copy?

thanks.

Reply With Quote


Sponsored Links
  #2  
Old 07-08-2007, 04:00 PM
Linuxsurgeon Linuxsurgeon is offline
WHT Addict
 
Join Date: May 2006
Posts: 145
The second time it will copy only those files which were changed or created from the earlier copy made.

Reply With Quote
  #3  
Old 07-08-2007, 09:33 PM
Jakiao Jakiao is offline
Community Guide
 
Join Date: Jun 2003
Location: Janesville, Wi
Posts: 1,509
Linuxsurgeon is incorrect.

The command you're using does not specify the -u flag which transfers only updated files. Without -u, it will retransfer everything regardless of whether or not it was changed (waste of bandwidth and time).

You might want to use "-arzgopu" for the flags. If you would like to delete files that no longer exist on the source server, add "--delete".

__________________
Jakiao

Reply With Quote
Sponsored Links
  #4  
Old 07-08-2007, 09:38 PM
foobic foobic is online now
Community Liaison 2.0
 
Join Date: Feb 2005
Location: Australia
Posts: 5,149
No, linuxsurgeon was correct - copying only changed files is the rsync default. Read up on the -u option - it's actually about updating newer files.

__________________
Chris

"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx

Reply With Quote
  #5  
Old 07-08-2007, 09:49 PM
Jakiao Jakiao is offline
Community Guide
 
Join Date: Jun 2003
Location: Janesville, Wi
Posts: 1,509
The person asked:

Quote:
does it mean rsync will just check and copy the newer folders and files from the last copy?
All he wants it to do is copy the newer files from the last. Using just "-avz" will resync everything. There is no checking. You need "-u" to copy JUST newer files. That is: files which have a newer modification time on the source server, files which exist on the source but not the target, any differences between source and target servers.

This is exactly what the poster asked for.

From CLI:
[root@backup network-scripts]# rsync --help | grep "\-u"
-u, --update update only (don't overwrite newer files)

From "man rsync":
-u, --update
This forces rsync to skip any files for which the destination file already exists and has a date later than the
source file.

In the currently implementation, a difference of file format is always considered to be important enough for an
update, no matter what date is on the objects. In other words, if the source has a directory or a symlink where
the destination has a file, the transfer would occur regardless of the timestamps. This might change in the future
(feel free to comment on this on the mailing list if you have an opinion).

__________________
Jakiao

Reply With Quote
  #6  
Old 07-08-2007, 10:10 PM
foobic foobic is online now
Community Liaison 2.0
 
Join Date: Feb 2005
Location: Australia
Posts: 5,149
rsync by default will resync everything - agreed. However resyncing does not mean re-transferring, it means transferring just the changed files, which is what most people want, including, I believe, the OP.

In this default usage if a file at the destination is newer than the one at the source, the newer file will get overwritten. Where the destination is a backup of some kind this is not an issue because it should never be changed except by rsync. However in special cases you might want to be able to update a file on the destination directory and not have that updated file overwritten by rsync, in which case you can use the -u flag.

If you seriously think rsync -avz re-transfers every file every time then try it for yourself and look at the rsync output.

__________________
Chris

"Learn from the mistakes of others. You can never live long enough to make them all yourself." - Groucho Marx

Reply With Quote
  #7  
Old 07-09-2007, 01:27 AM
HD Fanatic HD Fanatic is offline
Web Hosting Master
 
Join Date: Jan 2005
Posts: 2,099
I never had to use the -u in my rsync. It just transfer files that were changed, not having to copy everything over again after the first time.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
CIO New York Summit 2013 Web Hosting Events 2013-03-27 19:48:29
CIO Summit 2013 Web Hosting Events 2013-03-05 18:08:59
Time Warner Cable Opens $82M Data Center, Houses NaviSite Cloud Node Web Hosting News 2012-11-16 15:17:57
HCTS 2011 - Day Two Blog 2011-09-27 16:52:03
Time Warner Cable to Build Two Green Data Centers in Charlotte Web Hosting News 2011-07-11 19:45:15


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?