Created
July 13, 2017 11:41
-
-
Save stigok/51eff22ed2ddf5137b807f49ce951e60 to your computer and use it in GitHub Desktop.
Make openvpn reconnect when a network interface goes up
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 | |
# Initiates reconnect of the openvpn process | |
# | |
# Made for /etc/NetworkManager/dispatcher.d/, but should be working | |
# for /etc/network/if-up.d/ as well. | |
# | |
IFACE=$1 | |
ACTION=$2 | |
# If a device has gone up and it's not a tun device, send SIGHUP to openvpn | |
if [[ "${IFACE:0:3}" != 'tun' && "${ACTION}" = 'up' ]]; then | |
logger 'Restarting openvpn process (if running).' | |
pkill -SIGHUP openvpn | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment