Skip to content

Instantly share code, notes, and snippets.

@stevenwilliamson
Created October 11, 2017 13:46
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 stevenwilliamson/f780bbea170fba869a30809a2f13f7b3 to your computer and use it in GitHub Desktop.
Save stevenwilliamson/f780bbea170fba869a30809a2f13f7b3 to your computer and use it in GitHub Desktop.
#!/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