Skip to content

Instantly share code, notes, and snippets.

@shashir
Created November 10, 2015 02:38
Show Gist options
  • Save shashir/b3bc046d818a709e790e to your computer and use it in GitHub Desktop.
Save shashir/b3bc046d818a709e790e to your computer and use it in GitHub Desktop.
Run remote commands (simple)
#!/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