Created
November 10, 2015 02:38
-
-
Save shashir/b3bc046d818a709e790e to your computer and use it in GitHub Desktop.
Run remote commands (simple)
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 | |
SERVERS=( | |
# list of servers | |
) | |
# USER= | |
# SSH_KEY= | |
echo "Command to run is: $1" | |
for server in ${SERVERS[@]}; do | |
echo "-----------------------" | |
echo "${server}: $1" | |
echo "stdout:" | |
ssh -i ${SSH_KEY} $USER@$server $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment