blob: 7cc96b4d390aa82d553139c86c4c09a0094ecb47 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/sh
INTERFACE="${1}"
STATUS="${2}"
case "${STATUS}" in
up)
# VPN interfaces managed by networkmanager send events vpn-{up,down}.
# If the connection is started by whatever networkmanager sees this
# and triggers event up or down. Ignore these.
if ip tuntap | grep -q "^${INTERFACE}:"; then
echo "${0}: ${INTERFACE} changed status to up, but is tun/tap. Ignoring."
exit 0
fi
if pgrep -x openvpn >/dev/null; then
echo "${0}: ${INTERFACE} changed status to up, sending restart to openvpn."
kill -USR1 $(pgrep -x openvpn)
fi
;;
*)
echo "${0}: ${INTERFACE} changed status to ${STATUS}, ignoring."
;;
esac
|