Hi there, okay so I have a port knocker installed on my remote server so I am trying to bundle a bunch of directories in a single ssh session that rsync establishes. so far all the rsync examples I have seen require a new ssh session for each directory. is there anyway to get something like this into one line and therefore one ssh session. Clues on this? --- snip --- /usr/bin/rsync -avrz --human-readable --progress --update --perms --ignore-existing -e 'ssh -p <port> -o ServerAliveInterval=10' --delete --relative root@<hostname.net>:/etc '/shares/internal/<dir>/' /usr/bin/rsync -avrz --human-readable --progress --update --perms --ignore-existing -e 'ssh -p <port> -o ServerAliveInterval=10' --delete --relative root@<hostname.net>:/root '/shares/internal/<dir>/' --- snip --- Cheers, Noah
Kevin Korb
2011-Sep-19 03:01 UTC
rsync command for multi files and dirs from remote server
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Look into ssh connection sharing (search for ControlMaster). You can set ssh to use a single TCP connection (and authentication) for all ssh activity to a specific host. On 09/18/11 22:53, Noah wrote:> Hi there, > > okay so I have a port knocker installed on my remote server so I am > trying to bundle a bunch of directories in a single ssh session that > rsync establishes. so far all the rsync examples I have seen require a > new ssh session for each directory. > > is there anyway to get something like this into one line and therefore > one ssh session. Clues on this? > > --- snip --- > > /usr/bin/rsync -avrz --human-readable --progress --update --perms > --ignore-existing -e 'ssh -p <port> -o ServerAliveInterval=10' --delete > --relative root@<hostname.net>:/etc '/shares/internal/<dir>/' > /usr/bin/rsync -avrz --human-readable --progress --update --perms > --ignore-existing -e 'ssh -p <port> -o ServerAliveInterval=10' --delete > --relative root@<hostname.net>:/root '/shares/internal/<dir>/' > > --- snip --- > > Cheers, > > Noah- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk52sKEACgkQVKC1jlbQAQcEkACdFTjR4f9+R++o+oSVHn9xUyPP Q+oAnizyhYiAykhD6p2pzptUexid81hY =KV9D -----END PGP SIGNATURE-----
Benjamin R. Haskell
2011-Sep-19 03:06 UTC
rsync command for multi files and dirs from remote server
On Sun, 18 Sep 2011, Noah wrote:> Hi there, > > okay so I have a port knocker installed on my remote server so I am > trying to bundle a bunch of directories in a single ssh session that > rsync establishes. so far all the rsync examples I have seen require > a new ssh session for each directory. > > is there anyway to get something like this into one line and therefore > one ssh session. Clues on this?Try the ControlMaster=auto option to SSH with an appropriate ControlPath setting. Example of usage at: (Googled: SSH multiplex) http://www.linuxjournal.com/content/speed-multiple-ssh-connections-same-server As an '-e' argument, it'd be: -e 'ssh [...etc...] -o ControlMaster=auto -o ControlPath=~/.ssh/master-%r@%h:%p [...etc...]' -- Best, Ben