diff options
Diffstat (limited to 'debian/openvpn.if-down.d')
-rw-r--r-- | debian/openvpn.if-down.d | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/debian/openvpn.if-down.d b/debian/openvpn.if-down.d new file mode 100644 index 0000000..61b8476 --- /dev/null +++ b/debian/openvpn.if-down.d @@ -0,0 +1,21 @@ +#!/bin/sh + +OPENVPN=/usr/sbin/openvpn +OPENVPN_INIT=/etc/init.d/openvpn +SYSTEMCTL=/bin/systemctl +SYSTEMD=/run/systemd/system + +if [ ! -x $OPENVPN ]; then + exit 0 +fi + +if [ -n "$IF_OPENVPN" ]; then + for vpn in $IF_OPENVPN; do + ## check systemd present + if [ -d $SYSTEMD ]; then + $SYSTEMCTL stop openvpn@$vpn + else + $OPENVPN_INIT stop $vpn + fi + done +fi |