Created
October 11, 2017 13:46
-
-
Save stevenwilliamson/f780bbea170fba869a30809a2f13f7b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
set -uo pipefail | |
ZONE_NAME=2016Q4-builder | |
IMAGE=0d649af0-e6ed-11e6-8689-7fb3356bad96 | |
PACKAGE=r4-d30-c4 | |
ZONE_EXIST=false | |
ZONE_IP=$(triton instance ip $ZONE_NAME 2>/dev/null) | |
grep -E "^\d+\.\d+\.\d+\.\d+$" <<< $ZONE_IP > /dev/null | |
if [ $? -eq 0 ]; then | |
ZONE_EXIST=true | |
fi | |
if [ "$ZONE_EXIST" = false ]; then | |
triton instance create -ww -n $ZONE_NAME --script=setup.sh --network=service $IMAGE $PACKAGE | |
triton ssh $ZONE_NAME | |
else | |
echo "Logging in to existing instance" | |
triton ssh $ZONE_NAME | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment