Skip to content

Instantly share code, notes, and snippets.

@esteinborn
Created February 11, 2016 02:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esteinborn/28fc748f0537c40d46dc to your computer and use it in GitHub Desktop.
Save esteinborn/28fc748f0537c40d46dc to your computer and use it in GitHub Desktop.
REconnect PPTP VPN profile for Synology
#!/bin/sh
#version 2014-04-26
VPNC_CONNECTING="/usr/syno/etc/synovpnclient/vpnc_connecting"
#get connection name
CONNECTION=`cat /usr/syno/etc/synovpnclient/pptp/pptpclient.conf | grep conf_name | awk 'BEGIN {FS="="} {print $2}'`
#get connection id
ID=`ls /usr/syno/etc/synovpnclient/pptp/ | grep options | awk 'BEGIN {FS="_"} {print $2}' | awk 'BEGIN {FS="."} {print $1}'`
#create vpnc_connecting file
echo conf_id=$ID > $VPNC_CONNECTING && echo conf_name=$CONNECTION >> $VPNC_CONNECTING && echo proto=pptp >> $VPNC_CONNECTING
/usr/bin/killall synovpnc 2>/dev/null
#check running pptp
if echo `ifconfig ppp0` | grep -q "Link encap:Point-to-Point Protocol"
then
echo "VPN up"
else
/usr/syno/bin/synovpnc reconnect --protocol=pptp --name=$CONNECTION --retry=15 --interval=60 --keepfile &
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment