Created
December 5, 2015 14:14
-
-
Save meska/082e1ca9cb7717b2283e to your computer and use it in GitHub Desktop.
Synology openvpn check and restart script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# synology openvpn restart script | |
# get config and name here: | |
# cat /usr/syno/etc/synovpnclient/openvpn/ovpnclient.conf | |
if [[ `ifconfig | grep tun0 | wc -l` -eq 0 ]]; then | |
echo "Offline, restart" | |
echo conf_id=oXXXXXXXX > /usr/syno/etc/synovpnclient/vpnc_connecting | |
echo conf_name=XXXXXXXXXX >> /usr/syno/etc/synovpnclient/vpnc_connecting | |
echo proto=openvpn >> /usr/syno/etc/synovpnclient/vpnc_connecting | |
synovpnc reconnect --protocol=openvpn --name=XXXXXXXXXX | |
else | |
wget -q --tries=1 --timeout=10 --spider http://google.com | |
if [[ $? -eq 0 ]]; then | |
echo "Online" | |
else | |
echo "Hung, restart" | |
synovpnc kill_client | |
echo conf_id=oXXXXXXXXXX > /usr/syno/etc/synovpnclient/vpnc_connecting | |
echo conf_name=XXXXXXXXXX >> /usr/syno/etc/synovpnclient/vpnc_connecting | |
echo proto=openvpn >> /usr/syno/etc/synovpnclient/vpnc_connecting | |
synovpnc reconnect --protocol=openvpn --name=XXXXXXXXXX | |
fi | |
fi |
Thanks! Works with DSM 7.1
You are welcome ! I forgot about this gist 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Works with DSM 7.1