From 61c5dae777217183f1779f2b8f91f02b141cf744 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Mon, 28 Feb 2011 23:34:18 +0200
Subject: [PATCH 2/2] Make init script start openvpn for each *.ovpn in addition to *.conf.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
---
sample-scripts/openvpn.init | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/sample-scripts/openvpn.init b/sample-scripts/openvpn.init
index 821abd5..5de748d 100755
a
|
b
|
|
19 | 19 | # copy this file to /etc/rc.d/init.d/openvpn |
20 | 20 | # shell> chkconfig --add openvpn |
21 | 21 | # shell> mkdir /etc/openvpn |
22 | | # make .conf or .sh files in /etc/openvpn (see below) |
| 22 | # create .conf or .ovpn and optionally .sh files in /etc/openvpn (see below) |
23 | 23 | |
24 | 24 | # To uninstall: |
25 | 25 | # run: chkconfig --del openvpn |
… |
… |
|
33 | 33 | # |
34 | 34 | # The init script does the following: |
35 | 35 | # |
36 | | # - Starts an openvpn process for each .conf file it finds in |
| 36 | # - Starts an openvpn process for each .conf and .ovpn file it finds in |
37 | 37 | # /etc/openvpn. |
38 | 38 | # |
39 | | # - If /etc/openvpn/xxx.sh exists for a xxx.conf file then it executes |
| 39 | # - If /etc/openvpn/xxx.sh exists for a xxx.conf or xxx.ovpn then it executes |
40 | 40 | # it before starting openvpn (useful for doing openvpn --mktun...). |
41 | 41 | # |
42 | 42 | # - In addition to start/stop you can do: |
… |
… |
case "$1" in |
142 | 142 | rm -f $piddir/*.pid |
143 | 143 | cd $work |
144 | 144 | |
145 | | # Start every .conf in $work and run .sh if exists |
| 145 | # Start every .conf and .ovpn in $work and run .sh if exists |
146 | 146 | errors=0 |
147 | 147 | successes=0 |
148 | | for c in `/bin/ls *.conf 2>/dev/null`; do |
149 | | bn=${c%%.conf} |
| 148 | for c in `/bin/ls *.conf *.ovpn 2>/dev/null`; do |
| 149 | bn=${c%%.conf}; [ "$bn" = "$c" ] && bn=${c%%.ovpn} |
150 | 150 | if [ -f "$bn.sh" ]; then |
151 | 151 | . $bn.sh |
152 | 152 | fi |