Simplificatation
This commit is contained in:
parent
4c1f92d897
commit
b1fa87db3f
1 changed files with 5 additions and 38 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue