Last active
January 4, 2019 03:14
-
-
Save sanderpick/94076679d331215e336b1144c3a8c243 to your computer and use it in GitHub Desktop.
Upgrades a Textile cafe node on a remote Linux host
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
#!/usr/bin/env bash | |
set -e | |
while getopts k:r:p: option | |
do | |
case "${option}" | |
in | |
k) KEY=${OPTARG};; | |
r) RELEASE=${OPTARG};; | |
p) IP=${OPTARG};; | |
esac | |
done | |
[[ -z "$KEY" ]] && { echo "Please specify an SSH key, e.g., -k mykey.pem" ; exit 1; } | |
[[ -z "$RELEASE" ]] && { echo "Please specify a release tag, e.g., -r v1.0.0" ; exit 1; } | |
[[ -z "$IP" ]] && { echo "Please specify a public host IP address, e.g., -p 18.144.12.134" ; exit 1; } | |
# upload installer | |
scp -i "$KEY" cafe_reinstall.sh ec2-user@"$IP":~/ | |
# run installer | |
echo "./cafe_reinstall.sh -r $RELEASE" | ssh -i "$KEY" ec2-user@"$IP" /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment