Help with rsync
I consider myself fairly experienced w/ linux but rsync is just one of those apps I can't seem to make work. The man file and how to's all seem to either conflict or be missing something and when I can seem to get it working I run into strange errors.
I need to clone a directory of files and folders to another server. The folder to be copied is the "public_html" folder on the remote server, my goal being to copy it completely to a folder with the same name on my local server: Here's my rsync command - rsync -r -a -v -e "ssh -l user" domain.com:/public_html /home/user/public_html I get an error related to a stat failure of some kind (I don't have the error in front of me right now) What am I doing wrong? |
Can you post the full output of the error you are getting?
|
Yeah you need to post the error. Your use of -r is redundant because it's implied by using -a. I've never seen someone use -e before, so I've no idea if that's the correct way to use it. I'd use
Code:
$ rsync -av user@domain.com:public_html/ /home/user/public_html/ Code:
:/public_html Code:
:public_html If there are files already in the destination they'll still be there after you run rsync which means the contents of both directories will not be identical. If you want to make an exact copy of what's in the remote directory then use Code:
$ rsync -av --delete user@domain.com:/public_html/ /home/user/public_html/ You may want to add the --dry-run option to any command the first time you use it as that will show you what will be done but don't actually do it. |
Quote:
Code:
rsync -raveh --progress user@domain.com:/public_html/ /home/user/public_html/ |
Quote:
|
rsync [options] from to
if you want to rsync from your local computer to a remote host, then you would do this: Code:
rsync -varh --progress --delete /home/user/public_html/ user@domain.com:/public_html/ synchronize (verbose, archive, recursive, human readable, with progress indicator. Delete any remote files deleted from source.)FROM: /home/user/public_html/ TO: user@domain.com:/public_html/ If it happens to be over a wan link, you might save time by adding the -z compression option as well. Quote:
|
I just edited my post, the line starting 'not the lack' had at least three mistakes in it. :(
Quote:
Code:
$ rysnc source destination In your example the source is a directory on domain.com. If you prefix the directory with / it is considered to be an absolute path. So if you use this as the source Code:
bob@domain.com:/public_html Code:
bob@domain.com:public_html It's the difference between using a relative and an absolute path. If you don't know the difference between absolute and relative paths, you really ought to make sure you understand that before doing anything else. Basically if it starts with / then it's absolute. For more info see http://en.wikipedia.org/wiki/Path_%28computing%29 or probably many other places. |
Not sure, but i think ne0shell might be confused about the use of slashes. If you start a path with a "/" then you are specifying an absolute path from the root of your file system. If your current working directory is /home/user, then when you refer to "public_html" (without a slash) then that is NOT the same thing as "/public_html" with the slash. If you have a folder located at /public_html on your file system, it's probably because you accidentally added a leading slash in your rsync command.
|
See how confusing this stuff gets? I want to copy a remote folder to my local server, not the other way around.
Let me try this again. I need to copy the remote folder from path /home/user/public_html to my local server path /home/user/public_html using the ssh account user@domain.com for the remote machine. (I am logged in as root on the local server and do not have root on the remote server). |
Using the complete paths in both cases is much more likely to get you want. If you use a partial/relative path, then the copy locations would depend on the current working directory of whoever executes the command. If you were running is root, this might be /home/root/public_html or something like that.
You don't necessarily need root access on both servers. On the SOURCE server, you need read permission for all the files and directories to be copied. On the DESTINATION server, you need write permission for all the files and directories to be copied. |
Quote:
|
Depends on which machine you run the command from. Are you running it from the SOURCE machine or the DESTINATION machine?
|
Quote:
|
*You* should really read this thread as all the information you need has been supplied already. Or read the man pages on rsync:
Code:
$prompt: man rsync |
Quote:
None of the information given so far in the thread helps, unfortunately - it looks like most assumed the transfer was going in the opposite direction and my entire reason for posting the question here is that the man page for rsync is not clean and is not helping me solve the issue. |
All times are GMT -5. The time now is 05:01 PM. |