4 ms·
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 "
by desktopninja 5y ago
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
"
- caro11ne 5y agoI 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).