- Published on
VPN bash
#!/usr/bin/bash
VPN_HOME=/usr/bin/
ACCOUNT_NAME='optus'
function start(){
cd $VPN_HOME
sudo ./vpnclient start
./vpncmd localhost /client /CMD remoteenable
./vpncmd localhost /client /CMD accountconnect $ACCOUNT_NAME
#You can add your commands here
sudo ip route add 10.40.0.0/24 dev vpn_vpn
}
function stop(){
cd $VPN_HOME
sudo ./vpnclient stop
}
START="start"
STOP="stop"
HELP="help"
function help(){
echo "./vpn-manger.sh command"
echo "commands are $START , $STOP or $HELP"
}
function commands(){
COMMAND=$1
case "${COMMAND}" in
"$START") start; ;;
"$STOP") stop; ;;
esac
}
commands $1;