On 2022-06-10 14:17 :04, Ole Tange - o...@tange.dk wrote:
On Fri, Jun 10, 2022 at 12:54 AM Larry Ploetz<lploetz...@gmail.com> wrote:
I'm trying to use ssh's proxy (-J flag) with GNU parallel. The -J flag on ssh
allows multiple hosts to be specified with commas between them.
You clearly already know the , is the culprit.
Yep! Took a bit of sleuthing.
larryp-MBP:~ larry$ seq 48 | parallel -j0 --sshlogin '24/ssh -JINTHOST1,INHOST2
TARGETHOST' echo {}
I am not sure how this should be solved. --sshlogin allows you to
specify multiple sshlogins separated by comma:
parallel --sshlogin host1,host2
or:
parallel --sshlogin "myssh host1,myssh host2"
or:
parallel --sshlogin "24/ssh host1,16/ssh host2"
So the problem here is that comma is used in the ssh command.
Oh, that's the reason. Make sense.
Also, in attempting to get around that limitation:
larryp-MBP:~ larry$ seq 48 | parallel -j0 --sshlogin '24/ssh
-JINTHOST1\,INTHOST2 TARGETHOST' echo {}
And currently GNU Parallel does not support that: It splits on , even
if preceded by \ . But this might be a reasonable solution - it is
definitely doable. Though I cannot recall ever seeing a situation in
which you use \,
Currently you can workaround this by using ~/.ssh/config: here you can
put in ProxyJump for TARGETHOST.
I just wrote a script and used --sshlogin '24//path/to/script
TARGETHOST'. The .ssh/config would work but (in my situation) that would
require different host entries for the same hostname. Not a big deal,
but the script seemed easier in my case.
Or if the JumpHosts are the same for all servers:
parallel --ssh 'ssh -JINTHOST1,INTHOST2' --sshlogin 24/TARGETHOST
Oh! Didn't think of using both --ssh and --sshlogin - that would have
worked in my case.
To everyone else: What do you think? Is \, the right solution here?
Would ,, be better (it might be less intuitive but cause less quoting
stress)?
I like the double comma idea, FWIW. I also unfortunately like the idea
of quoting to indicate the comma isn't part of the target host
specification, but that could get real messy fast. Too bad ssh doesn't
have the idea of -I. ;-)
/Ole
· Larry