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 hidden or 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 |
Author
Thanks! Works with DSM 7.1
You are welcome ! I forgot about this gist 👍
Thanks! Works with DSM 7.1
Can you please explain this ? I can't seem to run it, no clue what's wrong here :( dsm7.1 as well... Nothings happening, perhaps the triggering in taskscheduler's not working ? Kinda lost here after previous vpn stuff suddenly stopped working ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Works with DSM 7.1