Skip to content

Instantly share code, notes, and snippets.

@ecarreras
Created February 12, 2013 13:46
Show Gist options
  • Select an option

  • Save ecarreras/4769981 to your computer and use it in GitHub Desktop.

Select an option

Save ecarreras/4769981 to your computer and use it in GitHub Desktop.
#!/bin/sh
VPN_PATH="/etc/openvpn/porta/[email protected]"
VPN_CONFIG="[email protected]"
case "$1" in
start)
echo "Connecting to GISCE VPN"
openvpn --client --config $VPN_PATH/$VPN_CONFIG &>$VPN_PATH/logfile &
;;
stop)
echo "Disconnecting from GISCE VPN"
VPN_PID=`ps aux|grep "openvpn --client "|awk '{print $2}'|head -n 1`
kill -9 $VPN_PID
;;
restart)
/etc/init.d/vpn-GISCE.sh stop
/etc/init.d/vpn-GISCE.sh start
;;
*)
echo "Usage: /etc/init.d/vpn-GISCE.sh {start|stop|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment