You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
494 B

  1. #!/bin/sh
  2. . /lib/functions.sh
  3. . /lib/mwan3/mwan3.sh
  4. LOG="logger -t $(basename "$0")[$$] -p"
  5. clean_up() {
  6. $LOG notice "Stopping mwan3rtmon..."
  7. exit 0
  8. }
  9. rtchange() {
  10. $LOG info "Detect rtchange event."
  11. }
  12. main() {
  13. local rtmon_interval
  14. trap clean_up TERM
  15. trap rtchange USR1
  16. config_load mwan3
  17. config_get rtmon_interval globals rtmon_interval '5'
  18. sleep 3
  19. while mwan3_rtmon_ipv4 || mwan3_rtmon_ipv6; do
  20. [ "$rtmon_interval" = "0" ] && break
  21. sleep $rtmon_interval
  22. done
  23. }
  24. main "$@"