aboutsummaryrefslogtreecommitdiffstats
path: root/pars.sh
blob: 79bc90593063ecde4bec3ebb94769a4a96a13500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

parssh () {
    [[ "$1" == -[0-9]* && "$1" != *[^0-9-]* ]] && {
      local parssh_concurrency=${1#-}
      shift
    }
    while read host; do
        while (( $(jobs -pr | wc -l) >= ${parssh_concurrency:-4} )); do
            sleep 1;
        done;
        ssh -no StrictHostKeyChecking=no $host "$@" &
    done
}