added extra commands "up" and "down" to selectively start or stop
authorMarkus Wigge <mwigge@marcant.net>
Tue, 11 Aug 2009 17:00:51 +0000 (17:00 +0000)
committerMarkus Wigge <mwigge@marcant.net>
Tue, 11 Aug 2009 17:00:51 +0000 (17:00 +0000)
single or multiple instances of openvpn.
This could be used from luci to manage running instances.

SVN-Revision: 17226

net/openvpn/files/openvpn.init

index d1974102195536984aa5652ed0486bf841355f27..7b447e06b6c436008e37f5ad7d5a6fb047a68b04 100644 (file)
@@ -7,6 +7,7 @@
 START=95
 BIN=/usr/sbin/openvpn
 SSD=start-stop-daemon
+EXTRA_COMMANDS="up down"
 
 LIST_SEP="
 "
@@ -142,3 +143,27 @@ reload() {
 restart() {
        stop; sleep 5; start
 }
+
+up() {
+       local exists
+       local INSTANCE
+       for INSTANCE in "$@"; do
+               config_load openvpn
+               config_get exists "$INSTANCE" TYPE
+               if [ "$exists" == "openvpn" ]; then
+                       start_service "$INSTANCE"
+               fi
+       done
+}
+
+down() {
+       local exists
+       local INSTANCE
+       for INSTANCE in "$@"; do
+               config_load openvpn
+               config_get exists "$INSTANCE" TYPE
+               if [ "$exists" == "openvpn" ]; then
+                       stop_service "$INSTANCE"
+               fi
+       done
+}