From 83253390cd814af11ff7c43542f7bc9d5d4eb5d9 Mon Sep 17 00:00:00 2001 From: Markus Wigge Date: Tue, 11 Aug 2009 17:00:51 +0000 Subject: [PATCH] added extra commands "up" and "down" to selectively start or stop single or multiple instances of openvpn. This could be used from luci to manage running instances. SVN-Revision: 17226 --- net/openvpn/files/openvpn.init | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/net/openvpn/files/openvpn.init b/net/openvpn/files/openvpn.init index d197410219..7b447e06b6 100644 --- a/net/openvpn/files/openvpn.init +++ b/net/openvpn/files/openvpn.init @@ -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 +} -- 2.30.2