mwan3: propagate mwan3 use command exit code

This propagates the exit code of the command wrapped by `mwan3 use` and
allows for example to use `mwan3 use` in monitoring scripts.

Before change:
shell command:
  mwan3 use wan false >/dev/null && echo ok || echo fail
result:
  ok

After change:
shell command:
  mwan3 use wan false >/dev/null && echo ok || echo fail
result:
  fail

Signed-off-by: Philipp Schmitt <philipp@schmitt.co>
This commit is contained in:
Philipp Schmitt
2025-02-18 17:16:45 +01:00
committed by Florian Eckert
parent 0a2746c6d6
commit 0c9f4a8410
2 changed files with 8 additions and 2 deletions

View File

@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=mwan3 PKG_NAME:=mwan3
PKG_VERSION:=2.11.17 PKG_VERSION:=2.11.18
PKG_RELEASE:=5 PKG_RELEASE:=5
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>, \ PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>, \
Aaron Goodman <aaronjg@alumni.stanford.edu> Aaron Goodman <aaronjg@alumni.stanford.edu>

View File

@@ -241,10 +241,16 @@ use() {
} }
case "$1" in case "$1" in
ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart|use|internal) ifup|ifdown|interfaces|policies|connected|rules|status|start|stop|restart|internal)
mwan3_init mwan3_init
"$@" "$@"
;; ;;
use)
mwan3_init
"$@"
# Propagate mwan3 use command exit code
exit "$?"
;;
*) *)
help help
;; ;;