All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Help, rsync is being a massive prick
Hello folks, I'm stuck and I need a hand. This may be something simple, but I just cannot see what it's happening, and if I'm not figuring it out after an hour, I'm probably not going to. I also have flu, so it's entirely possible my addled brain has failed somewhere along the way.
I'm attempting to synchronise (temporarily) my Plex servers, so I can switch between the two at will. I'm failing at the intial synchronisation of data.
I'm running the following command from the source server:
rsync -r -a -v -e "ssh -l user" --delete "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/" user@destinationserver:"/var/lib/plexmediaserver/Library/Application Support/Plex Media Server"
What actually happens is that the rsync job creates the folder 'Application' at the location '/var/lib/plexmediaserver/Library/' and stuffs everything in there. I've also tried the above command minus the quotation marks, using \ to escape the spaces, and the result is the same.
If it matters, I'm running Debian 7 64 bit on both servers.
Help gratefully received. Insults less gratefully received, but if they get me on the road to where I need to be, we're all good.
Comments
Simple solution would be using 'ln -s' to create a symbolic link name without spaces for that directory on both machines...
My first thought is tic marks, checking now..
EDIT: it seems escaping the spaces in the second arg with single quotes worked. Tic marks did not. I have adjusted the above
Cheers, but I'd rather work out where I'm going wrong than use a sticking plaster at this stage.
Doesn't make any difference, I've tried all the reasonable methods I can think of to deal with the spaces in filenames.
Edit: assuming you actually meant changing the double quotes to single quotes. Tic marks are something entirely different to me.
you can try
-s, --protect-args
as rsync argument.
BINGO! thank you, my good man.
Seems to be working, but I'll leave this open for the time being incase shit crops up again.
Note that is slash '/' is NOT specified on target path, rsync will create directories under it. Specify slashes if you need to copy files tree from one network path to another as is.
strip the slash?
No, add terminal slash to target path, too.
I'm aware of that, the lack of the final of the destination slash was entirely intentional.
OK, then I assume whitespace is your killer.
Does this offer a solution?
Little tip you can specify -zvra rather than -z -v -r -a etc.
Interesting solution, but the -s --protect-args option worked perfectly well.
Yeah I know, old habits die hard.
If ti doesn't for some reason, I'd use whatever works.
When the above is, in turn, called from a shell script, then it becomes a real challenge. Personally, I try to avoid using whitespace at all, wherever possible. The way it should be escaped begets monstrous constructions.
I agree totally, I never have whitespace on file/folder names personally, but this isn't my software :-/
Why use -a and -r doesn't -a do recursion already?
Eh, non-impacting typo.
Somebody should create an rsync gui app. I find rsync command line to be quite cryptic. Difficult to memorize if you don't use it every day.