Created
February 29, 2016 17:12
-
-
Save imjacobclark/91f27ac86887950d3cc8 to your computer and use it in GitHub Desktop.
command-over-several-boxes.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTS=(); | |
CMD="$1" | |
echo "Hit CTRL-C to stop" | |
sleep 0.5 | |
PIDS="" | |
for host in ${HOSTS[*]} | |
do | |
ssh $host $CMD & | |
PIDS="$PIDS $!" | |
done | |
trap "kill $PIDS" SIGINT | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment