Last active
August 29, 2015 14:01
-
-
Save zhimsel/6e179bd058cb04143f5a to your computer and use it in GitHub Desktop.
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 | |
# define some functions | |
###################################### | |
# command | |
run_command () { | |
echo "" | |
echo "----------------------" | |
echo "Running '$COMMAND' on $SERVER" | |
echo "$COMMAND" | ssh "$SSH_OPTIONS" "$SERVER" /bin/bash | |
} | |
###################################### | |
# if next arg is a file, then use that as the list of servers | |
# otherwise use the remaining args as your server list | |
# and then do it! | |
if [ -f "$1" ]; then | |
while read SERVER; do | |
run_command | |
done < "$1" | |
else | |
for SERVER in "$@"; do | |
run_command | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment