From: Daniel F. Dickinson Date: Thu, 2 Jul 2026 22:50:40 +0000 (-0400) Subject: nut: do not trigger on interface activity by default X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=0bd44d9b9de2d79ca685d715cddcf1f82ff75738;p=openwrt-packages.git nut: do not trigger on interface activity by default The defaults were triggiering on any activity on the network, which caused excessive restarts. So default to no interface trigger, with 'all' (or specific interfaces) as an option. See https://github.com/openwrt/packages/pull/29607#discussion_r3463553192 Signed-off-by: Daniel F. Dickinson --- diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init index 9383950c1..6de2ba18a 100644 --- a/net/nut/files/nut-monitor.init +++ b/net/nut/files/nut-monitor.init @@ -92,7 +92,7 @@ service_preconditions() { fi build_config || return 1 - interface_triggers "check_interface_up" || return 1 + interface_triggers "check_interface_up" "upsmon" || return 1 return 0 ;; *) @@ -211,6 +211,8 @@ service_triggers() { config_get interface_reload_delay upsmon interface_reload_delay $DEFAULT_PROCD_INTERFACE_RELOAD_DELAY + # We do not pass an instance name as the nut-monitor initscript does not need + # an additional instance argument interface_triggers "add_trigger" "upsmon" "$interface_reload_delay" "nut-monitor" || { log_error_exit "Failed to add interface triggers" nut-monitor nut-monitor } diff --git a/net/nut/files/nut-server.init b/net/nut/files/nut-server.init index ad4af958f..1a593f7e5 100644 --- a/net/nut/files/nut-server.init +++ b/net/nut/files/nut-server.init @@ -256,7 +256,7 @@ service_preconditions() { case $ret in 0) - interface_triggers "check_interface_up" || should_start_srv=false + interface_triggers "check_interface_up" "upsd" || should_start_srv=false ;; *) should_start_srv=false @@ -269,7 +269,7 @@ service_preconditions() { case $ret in 0 | 2) - interface_triggers "check_interface_up" || should_stop_srv=true + interface_triggers "check_interface_up" "upsd" || should_stop_srv=true ;; *) should_stop_srv=true diff --git a/net/nut/files/nut-service.sh.functions b/net/nut/files/nut-service.sh.functions index 44cba46ce..fda69ce60 100644 --- a/net/nut/files/nut-service.sh.functions +++ b/net/nut/files/nut-service.sh.functions @@ -278,7 +278,9 @@ interface_triggers() { local section="$2" local interface_reload_delay="${3:-$DEFAULT_PROCD_INTERFACE_RELOAD_DELAY}" local initscript="$4" - local daemon="$5" + if [ $# -ge 4 ]; then + shift 4 + fi local interfaces interface local have_up_interface local trigger_failed @@ -289,7 +291,7 @@ interface_triggers() { # We do not need to log or otherwise 'notice' other actions case "$action" in add_trigger) - if [ -n "$interfaces" ]; then + if [ -n "$interfaces" ] && [ "$interfaces" != "all" ]; then set -f trigger_failed="false" # interfaces is deliberately unquoted so we get word-splitting for @@ -297,21 +299,23 @@ interface_triggers() { for interface in $interfaces; do # We use the variadic third and fourth parameters of procd_add_interface_trigger to # restart instead of reload on interface up/down events. Additionally the variadic - # fourth and fifth parameters of procd_add_interface_trigger are passed through to - # the