dotfiles/scripts/prefix/bin/vpn
2016-09-04 03:29:23 +02:00

43 lines
726 B
Bash
Executable file

#!/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"
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