Created
July 4, 2018 07:39
-
-
Save bulletmark/a276436282eeda967c52a36162b4cb5c to your computer and use it in GitHub Desktop.
Script to run given first argument command across given machines
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 | |
# Run given first argument command across given machines | |
# M.Blakeney, Jul 2018. | |
script=$1 | |
shift | |
hosts=$* | |
bscript=$(basename $script) | |
for h in $hosts; do | |
rsync -a $script $h:/tmp/ | |
echo === $h === | |
ssh $h /tmp/$bscript | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment