From f7b895470a68f9e411b26ee297ca9cf0e419f522 Mon Sep 17 00:00:00 2001 From: Euan Reid Date: Sat, 26 Nov 2016 16:21:31 -0800 Subject: [PATCH] Cleaner connection attempt with viscosity --- ec2gaming.cfg | 2 +- scripts/ec2gaming-vpnup.viscosity.scpt | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ec2gaming.cfg b/ec2gaming.cfg index d6b39f9..267a88a 100644 --- a/ec2gaming.cfg +++ b/ec2gaming.cfg @@ -1,3 +1,3 @@ INSTANCE_TYPE="g2.2xlarge" SPOT_PRICE_BUFFER="0.10" -VPN_CLIENT="tunnelblick" +VPN_CLIENT="viscosity" diff --git a/scripts/ec2gaming-vpnup.viscosity.scpt b/scripts/ec2gaming-vpnup.viscosity.scpt index 77bfa9b..259da41 100644 --- a/scripts/ec2gaming-vpnup.viscosity.scpt +++ b/scripts/ec2gaming-vpnup.viscosity.scpt @@ -1,8 +1,11 @@ tell application "Viscosity" - connect (connections where name is "ec2gaming") - set currentState to state of connections where name is "ec2gaming" - repeat until currentState = "Connected" - delay 1 + set currentState to "Unknown" + repeat until (currentState = "Connected") + if currentState = "Disconnected" then + connect (connections where name is "ec2gaming") + end if set currentState to state of connections where name is "ec2gaming" + set currentState to currentState as string + delay 1 end repeat end tell