mwan3: propagate mwan3 use command exit code
authorPhilipp Schmitt <philipp@schmitt.co>
Tue, 18 Feb 2025 16:16:45 +0000 (17:16 +0100)
committerFlorian Eckert <Eckert.Florian@googlemail.com>
Thu, 20 Feb 2025 06:59:20 +0000 (07:59 +0100)
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>
net/mwan3/Makefile
net/mwan3/files/usr/sbin/mwan3

index 1a8a5d3d4aacf6d476e1067880f91353cf9cc036..d951b191785e99c3b05980bb85ae086dc5281dd0 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=mwan3
-PKG_VERSION:=2.11.17
+PKG_VERSION:=2.11.18
 PKG_RELEASE:=5
 PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>, \
                Aaron Goodman <aaronjg@alumni.stanford.edu>
index e884d22f6be01846e7f982aad3e6093a893e0140..9162cb477c0c2de43abd9612ac780d3129857d4e 100755 (executable)
@@ -241,10 +241,16 @@ use() {
 }
 
 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
                "$@"
        ;;
+       use)
+               mwan3_init
+               "$@"
+               # Propagate mwan3 use command exit code
+               exit "$?"
+       ;;
        *)
                help
        ;;