News for hackers. Stuff that matters.
Re:GNU Parallel by desktopninja on Monday April 04, 2022 @07:26PM (#30913304)
Can't quite pin my resistance to parallel but I've enjoyed using this magic for many moons now:

xargs -t -n 1 -P 3 -I TARGET_COMPUTER ssh -q TARGET_COMPUTER "

sleep \$(shuf -i 1-9 | head -1)

echo \$(hostname; date)

echo \"===> \$(hostname) <===\"

> ~/I_WAS_HERE

" <<< "

server-01

server-02

server-03

server-04

server-05 "

Re:GNU Parallel by caro11ne on Sunday April 10, 2022 @06:19PM (#30982303)
I use:

    iwashere() {
      sleep $(shuf -i 1-9 | head -1)
      date
      echo "===> $(hostname) <===" > ~/I_WAS_HERE
    }
    env_parallel -Sserver-0{1..5} --tag --nonall iwashere
I like that I can try out the function locally before running it remotely.

I like that I do not have to give xargs a multiline argument.

I am terrible at quoting inside quoting inside quoting, so I like that I can simply avoid the quoting. I also think my colleagues will find it easier to read (thus maintain).