From 9f931911e331afd517b53477f73f96f26f1de84b Mon Sep 17 00:00:00 2001 From: Martin Potier Date: Sun, 4 Sep 2016 03:29:23 +0200 Subject: [PATCH] better vpn commands --- scripts/prefix/bin/vpn | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/prefix/bin/vpn b/scripts/prefix/bin/vpn index e3f24c6..af5dc08 100755 --- a/scripts/prefix/bin/vpn +++ b/scripts/prefix/bin/vpn @@ -1,5 +1,13 @@ #!/bin/sh +HARDPROFILE="2947fbbad4" +if [[ $(hostname) == "DeathStar" ]] +then + OODPROFILE="OodDeathStar" +else + OODPROFILE="OodCanine" +fi + if [[ $# -ne 1 ]] then echo "$(basename $0) requires exactly one of: hard, medium, off" @@ -7,10 +15,10 @@ then else case $1 in "hard") - PROFILE="2947fbbad4" + PROFILE=$HARDPROFILE ;; "medium") - [[ $(hostname) == "DeathStar" ]] && PROFILE="OodDeathStar" || PROFILE="OodCanine" + PROFILE=$OODPROFILE ;; "off") ;; @@ -20,14 +28,16 @@ else ;; esac - sudo systemctl stop openvpn@2947fbbad4.service - sudo systemctl stop openvpn@OodCanine.service + sudo systemctl stop openvpn@$HARDPROFILE.service + sudo systemctl stop openvpn@$OODPROFILE.service sleep 1s if [[ -n $PROFILE ]] then sudo systemctl start openvpn@$PROFILE.service + echo "$PROFILE started" + else + echo "All stopped." fi - echo "$PROFILE started" fi