better vpn commands

This commit is contained in:
Martin Potier 2016-09-04 03:29:23 +02:00
parent f21d7e7f11
commit 9f931911e3

View file

@ -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
fi
echo "$PROFILE started"
else
echo "All stopped."
fi
fi