net/mwan3: add init script to enable/disable mwan3 globally

Adding a init script to "/etc/init.d/" introduce the possibility to
enable/disable mwan3 globally.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2018-02-05 10:15:03 +01:00
parent 4d5c752f45
commit f9a787e8df
5 changed files with 59 additions and 4 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh /etc/rc.common
START=19
reload() {
local enabled
config_load mwan3
config_get_bool enabled globals 'enabled' 0
[ ${enabled} -gt 0 ] || {
echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
exit 0
}
mwan3 restart
}
boot() {
. /lib/config/uci.sh
uci_toggle_state mwan3 globals enabled "1"
}
start() {
. /lib/config/uci.sh
uci_toggle_state mwan3 globals enabled "1"
mwan3 start
}
stop() {
. /lib/config/uci.sh
uci_toggle_state mwan3 globals enabled "0"
mwan3 stop
}