From b1fa87db3fab9157404efd973b19587330c9cee9 Mon Sep 17 00:00:00 2001 From: Martin Potier Date: Thu, 23 Feb 2017 17:24:06 +0100 Subject: [PATCH] Simplificatation --- scripts/prefix/bin/vpn | 43 +++++------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/scripts/prefix/bin/vpn b/scripts/prefix/bin/vpn index af5dc08..9b81963 100755 --- a/scripts/prefix/bin/vpn +++ b/scripts/prefix/bin/vpn @@ -1,43 +1,10 @@ #!/bin/sh +sudo systemctl stop openvpn-client@DeathStar.service -HARDPROFILE="2947fbbad4" -if [[ $(hostname) == "DeathStar" ]] +if [[ $1 = "on" ]] then - OODPROFILE="OodDeathStar" + sudo systemctl start openvpn-client@DeathStar.service + echo "VPN started" else - OODPROFILE="OodCanine" + echo "All stopped." fi - -if [[ $# -ne 1 ]] -then - echo "$(basename $0) requires exactly one of: hard, medium, off" - exit 1 -else - case $1 in - "hard") - PROFILE=$HARDPROFILE - ;; - "medium") - PROFILE=$OODPROFILE - ;; - "off") - ;; - *) - echo "Wrong command, either hard, medium or off" - exit 2 - ;; - esac - - 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 -fi -