Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Help, rsync is being a massive prick
New on LowEndTalk? Please Register and read our Community Rules.

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...

    Thanked by 1Nekki
  • FrankZFrankZ Veteran
    edited February 2015

    My first thought is tic marks, checking now..

    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'
    

    EDIT: it seems escaping the spaces in the second arg with single quotes worked. Tic marks did not. I have adjusted the above

    Thanked by 1Nekki
  • NekkiNekki Veteran
    edited February 2015

    foetti said: Simple solution would be using 'ln -s' to create a symbolic link name without spaces for that directory on both machines...

    Cheers, but I'd rather work out where I'm going wrong than use a sticking plaster at this stage.

    FrankZ said: My first thought is tic marks, checking now..

    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.

    Thanked by 4Nekki ehab FrankZ netomx
  • foetti said: 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.

    Thanked by 1ATHK
  • strip the slash?

  • @wych said:
    strip the slash?

    No, add terminal slash to target path, too.

  • @Master_Bo said:
    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.

    I'm aware of that, the lack of the final of the destination slash was entirely intentional.

  • @Nekki said:
    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?

    Thanked by 1Nekki

  • rsync -rav --delete /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media Server/* user@destinationserver:/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/
  • J1021J1021 Member
    edited February 2015

    Little tip you can specify -zvra rather than -z -v -r -a etc.

  • NekkiNekki Veteran
    edited February 2015

    @Master_Bo said:
    OK, then I assume whitespace is your killer.

    Does this offer a solution?

    Interesting solution, but the -s --protect-args option worked perfectly well.

    @kcaj said:
    Little tip you can specify -zvra rather than -z -v -r -a etc.

    Yeah I know, old habits die hard.

    Thanked by 1Master_Bo
  • @Nekki said:
    Interesting solution, but the -s --protect-args option worked perfectly well.

    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.

  • @Master_Bo said:
    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?

  • Ishaq said: Why use -a and -r doesn't -a do recursion already?

    Eh, non-impacting typo.

  • smansman Member
    edited February 2015

    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.

Sign In or Register to comment.