Skip to content

Instantly share code, notes, and snippets.

@jskrivseth
Created August 29, 2020 15:35
Show Gist options
  • Save jskrivseth/86921918c41097eac5d13a1926c59c5c to your computer and use it in GitHub Desktop.
Save jskrivseth/86921918c41097eac5d13a1926c59c5c to your computer and use it in GitHub Desktop.
Run apt update on all hosts
#!/bin/bash
hosts=( "host3" "host4" )
for i in "${hosts[@]}"
do
echo "----------"
echo "- Host: $i"
ssh -q "$i" << SSH_COMMANDS
sudo apt-get upgrade -y
exit
SSH_COMMANDS
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment