Howdy, Stranger!

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

Subscribe to our newsletter

Advertise on LowEndTalk.com

Latest LowEndBox Offers

    Help, rsync is being a massive prick
    New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

    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/"  [email protected]:"/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 Member
      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/'  [email protected]:'/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 Moderator
      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.

    • NekkiNekki Moderator

      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
      Monitor your network assets with IPHost (PM me for discount code)
    • strip the slash?

      Taking a hiatus.

    • @wych said:
      strip the slash?

      No, add terminal slash to target path, too.

      Monitor your network assets with IPHost (PM me for discount code)
    • NekkiNekki Moderator

      @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
      Monitor your network assets with IPHost (PM me for discount code)

    • rsync -rav --delete /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media Server/* [email protected]:/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 Moderator
      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.

      Monitor your network assets with IPHost (PM me for discount code)
    • NekkiNekki Moderator

      @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 :-/

    • IshaqIshaq Member, Provider

      Why use -a and -r doesn't -a do recursion already?

      [BudgetNode] DDoS Protected. 7 Locations (US/EU). Check out our latest offer!
    • NekkiNekki Moderator

      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.