summaryrefslogtreecommitdiff
path: root/net/rtpproxy/files
diff options
context:
space:
mode:
authorSebastian Kemper <sebastian_ml@gmx.net>2018-11-05 20:16:54 +0100
committerSebastian Kemper <sebastian_ml@gmx.net>2018-11-05 20:16:56 +0100
commit0b092cbe2b5eed5dd6f9140ee35860ac32bdd577 (patch)
treeeb1d8c1236776984115481e69d7f6af6874eba77 /net/rtpproxy/files
parent72cb5b8350abcb112f20e4a92efa791c4686ab3c (diff)
rtpproxy: add hotplug script
Install hotplug script along with rtpproxy. It will only be used if enabled by the user (via uci config file). Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Diffstat (limited to 'net/rtpproxy/files')
-rw-r--r--net/rtpproxy/files/rtpproxy.config3
-rw-r--r--net/rtpproxy/files/rtpproxy.hotplug24
2 files changed, 27 insertions, 0 deletions
diff --git a/net/rtpproxy/files/rtpproxy.config b/net/rtpproxy/files/rtpproxy.config
index 7087251..2350c11 100644
--- a/net/rtpproxy/files/rtpproxy.config
+++ b/net/rtpproxy/files/rtpproxy.config
@@ -12,3 +12,6 @@ config instance 'site2'
option socket 'udp:127.0.0.1:7724'
option ipaddr '192.168.1.1'
+config rtpproxy 'hotplug'
+ #option interface 'wan' # uncomment to enable hotplug
+
diff --git a/net/rtpproxy/files/rtpproxy.hotplug b/net/rtpproxy/files/rtpproxy.hotplug
new file mode 100644
index 0000000..dfa6981
--- /dev/null
+++ b/net/rtpproxy/files/rtpproxy.hotplug
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+[ "$ACTION" = ifup ] || exit 0
+
+NAME=rtpproxy
+COMMAND=/etc/init.d/$NAME
+LOGGER="/usr/bin/logger -t hotplug"
+
+$COMMAND enabled || exit 0
+
+. /lib/functions.sh
+
+config_load $NAME
+
+config_get_bool enabled global enabled 0
+[ $enabled -eq 0 ] && exit 0
+
+config_get hotplug_iface hotplug interface
+
+[ "$INTERFACE" = "$hotplug_iface" ] && {
+ $LOGGER "Restarting $NAME due to \"$ACTION\" of \"$INTERFACE\""
+ $COMMAND restart
+}
+