From 5cab23499f22fdb6030f1baf84d50630bffbe782 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 27 Jan 2011 21:57:38 +0000 Subject: [PATCH] - upstart config Changed files: openvpn-tunnel.upstart -> 1.1 openvpn.upstart -> 1.1 --- openvpn-tunnel.upstart | 13 +++++++++++++ openvpn.upstart | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 openvpn-tunnel.upstart create mode 100644 openvpn.upstart diff --git a/openvpn-tunnel.upstart b/openvpn-tunnel.upstart new file mode 100644 index 0000000..381e5da --- /dev/null +++ b/openvpn-tunnel.upstart @@ -0,0 +1,13 @@ +# openvpn tunnel daemon +# +# This service runs specified tunnel + +stop on pld.network-stopped + +manual + +#console output + +respawn +instance $TUNNEL +exec /usr/sbin/openvpn --config /etc/openvpn/$TUNNEL.conf --writepid /var/run/openvpn/$TUNNEL.pid --cd /etc/openvpn diff --git a/openvpn.upstart b/openvpn.upstart new file mode 100644 index 0000000..13abace --- /dev/null +++ b/openvpn.upstart @@ -0,0 +1,33 @@ +description "Start the OpenVPN tunnels" + +start on pld.network-started +stop on pld.network-stopped + +task +console output + +script + [ -f /etc/sysconfig/openvpn ] && . /etc/sysconfig/openvpn + + for tun in $TUNNELS; do + if [ ! -f "/etc/openvpn/$tun.conf" ]; then + # skip invalid tunnels + continue + fi + + initctl start openvpn-tunnel TUNNEL=$tun >/dev/null || : + done +end script + +pre-stop script + [ -f /etc/sysconfig/openvpn ] && . /etc/sysconfig/openvpn + + for tun in $TUNNELS; do + if [ ! -f "/etc/openvpn/$tun.conf" ]; then + # skip invalid tunnels + continue + fi + + initctl stop openvpn-tunnel TUNNEL=$tun >/dev/null || : + done +end script -- 2.44.0