This bug was introduced since dd206b7d0b
mwan3_remon_ipv4 and mwan3_remon_ipv6 is command to run not a variable
I add some comments on them hopefully people will notice it
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
38 lines
623 B
Bash
Executable file
38 lines
623 B
Bash
Executable file
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
. /lib/mwan3/mwan3.sh
|
|
|
|
LOG="logger -t $(basename "$0")[$$] -p"
|
|
|
|
clean_up() {
|
|
$LOG notice "Stopping mwan3rtmon..."
|
|
exit 0
|
|
}
|
|
|
|
rtchange() {
|
|
$LOG info "Detect rtchange event."
|
|
}
|
|
|
|
main() {
|
|
local rtmon_interval
|
|
trap clean_up TERM
|
|
trap rtchange USR1
|
|
|
|
config_load mwan3
|
|
config_get rtmon_interval globals rtmon_interval '5'
|
|
|
|
sleep 3
|
|
while true; do
|
|
mwan3_lock "service" "mwan3rtmon"
|
|
mwan3_rtmon_ipv4 || mwan3_rtmon_ipv6
|
|
ret=$?
|
|
mwan3_unlock "service" "mwan3rtmon"
|
|
[ "$ret" = "0" ] || break
|
|
[ "$rtmon_interval" = "0" ] && break
|
|
sleep "$rtmon_interval" &
|
|
wait
|
|
done
|
|
}
|
|
|
|
main "$@"
|