1

I run this simple command on the host:

apt update > /dev/null 2>&1 && apt upgrade -y  > /dev/null 2>&1 && wget -4 -q --header 'XXXX' -O - https://raw.githubusercontent.com/XXX/add.sh | bash -x

To make my life easier I use base64 to encode this, and then decode on the host, so I don't have to worry about my own terminal getting in the way

parallel-ssh -t 500 -O StrictHostKeyChecking=no -i -h /root/hosts -x "-i /root/.ssh/ssh_host_ed25519_key" 'BASE64 STRING | base64 -w 0 -d | bash'

But my script is getting executed 2 times on the host. I have no idea why. The original command on the host works as expected, piping the sh script to bash and executing only once. The behavior changes in parallel-ssh.

Why?

1 Answer 1

0

If you have GNU Parallel try (untested):

env_parallel --session
doit() {
  apt update > /dev/null 2>&1 &&
    apt upgrade -y  > /dev/null 2>&1 &&
    wget -4 -q --header 'XXXX' -O - https://raw.githubusercontent.com/XXX/add.sh |
    bash -x
}
env_parallel --nonall --ssh 'ssh -O StrictHostKeyChecking=no -i -h /root/hosts -x "-i /root/.ssh/ssh_host_ed25519_key"' -S server1,server2 doit
env_parallel --end-session

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .