Created
March 17, 2016 10:57
-
-
Save Dih5/1aeb7bd03d9a5a7677dd to your computer and use it in GitHub Desktop.
Run a command in a list of servers. (Note there are better tools to do this like pssh pdsh, ...)
This file contains 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 | |
#Server list: | |
declare -a arr=("server1" "server2" "server3") | |
#Command to execute: | |
cmd="./cpuuse.sh" | |
for i in "${arr[@]}" | |
do | |
echo "***Connecting to $i***" | |
ssh "$i" "$cmd" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment