Restart Synology VPN connection
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/bash | |
####################### | |
# Setup: | |
# 1. Setup a VPN in the Synology web interface | |
# 2. Log in via SSH | |
# 3. Take a look at /usr/syno/etc/synovpnclient/openvpn/ovpnclient.conf | |
# 4. Find your VPN entry and fill in the variables below. | |
# ID = the CLIENT ID, shown between square brackets, e.g. "[o123456789]" | |
# CONFNAME = value of "conf_name" | |
# | |
# Usage: | |
# ./syno-vpn-reconnect.sh | |
# | |
####################### | |
set -e | |
########################################################## | |
CONNFILE=/usr/syno/etc/synovpnclient/vpnc_connecting | |
ID=o123456789 # <-- REPLACE THIS WITH YOUR CLIENT ID | |
CONFNAME=myclient # <-- REPLACE THIS WITH YOUR CONF NAME | |
########################################################## | |
echo "*** Triggering disconnect" | |
synovpnc kill_client --name=$CONFNAME | |
echo "*** Waiting 5 seconds" | |
sleep 5 | |
echo "*** Triggering connect" | |
echo conf_id=$ID > $CONNFILE | |
echo conf_name=$CONFNAME >> $CONNFILE | |
echo proto=openvpn >> $CONNFILE | |
synovpnc connect --id=$ID | |
echo "*** Waiting 15 seconds" | |
sleep 15 | |
echo "*** Should be connected. Dumping VPN status:" | |
synovpnc get --name=$CONFNAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks !