Skip to content

Instantly share code, notes, and snippets.

@bulletmark
Created July 4, 2018 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bulletmark/a276436282eeda967c52a36162b4cb5c to your computer and use it in GitHub Desktop.
Save bulletmark/a276436282eeda967c52a36162b4cb5c to your computer and use it in GitHub Desktop.
Script to run given first argument command across given machines
!/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