summaryrefslogtreecommitdiff
path: root/debian/openvpn.if-up.d
diff options
context:
space:
mode:
Diffstat (limited to 'debian/openvpn.if-up.d')
-rw-r--r--debian/openvpn.if-up.d21
1 files changed, 21 insertions, 0 deletions
diff --git a/debian/openvpn.if-up.d b/debian/openvpn.if-up.d
new file mode 100644
index 0000000..3e88f18
--- /dev/null
+++ b/debian/openvpn.if-up.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 --no-block start openvpn@$vpn
+ else
+ $OPENVPN_INIT start $vpn
+ fi
+ done
+fi