diff options
author | James Pannacciulli <jpnc@jpnc.info> | 2015-01-23 09:40:18 -0800 |
---|---|---|
committer | James Pannacciulli <jpnc@jpnc.info> | 2015-01-23 09:40:18 -0800 |
commit | a3199903b64115b9d83493b46ea2a0a1ca6c18db (patch) | |
tree | eb117b5e34aae4af5b8095c7002b22597ea71baa | |
download | parssh-a3199903b64115b9d83493b46ea2a0a1ca6c18db.tar.gz parssh-a3199903b64115b9d83493b46ea2a0a1ca6c18db.tar.bz2 |
parssh - parallel ssh exec w/ custom concurrency - first commit
-rw-r--r-- | pars.sh | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -0,0 +1,15 @@ +#!/bin/bash + +parssh () +{ + [[ "$1" == -[0-9]* && "$1" != *[^0-9-]* ]] && { + 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 +} |