From: markus Date: Tue, 11 Aug 2009 17:00:51 +0000 (+0000) Subject: added extra commands "up" and "down" to selectively start or stop X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=df86baf7e40721c608dce26bdc1b748a66513081;p=packages.git 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. git-svn-id: svn://svn.openwrt.org/openwrt/packages@17226 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/net/openvpn/files/openvpn.init b/net/openvpn/files/openvpn.init index d19741021..7b447e06b 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 +}