]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tools: suppress unuseful warnings during restarting frr
authoranlan_cs <vic.lan@pica8.com>
Sat, 22 Jan 2022 01:33:30 +0000 (20:33 -0500)
committeranlan_cs <vic.lan@pica8.com>
Sat, 22 Jan 2022 02:23:22 +0000 (21:23 -0500)
Problem:
During restarting frr.service, it throws annoying warnings:
Cannot stop bgpd(and others): pid file not found.

Root Cause:
During restarting process, systemd uses "stop", and watchfrr
uses "restart".
Yes, watchfrr using "restart" is to avoid systemd failing to stop.
But it should be quiet.

Fix:
During restarting service, suppress these warnings from watchfrr.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
tools/frrcommon.sh.in

index 7cde7a119e663e47865e0ebc3cee0f1d3bc97401..d95f2d4be7ac1ca3e7b092c00a13c61dd970aad0 100644 (file)
@@ -191,7 +191,7 @@ daemon_stop() {
        [ -z "$fail" -a -z "$pid" ] && fail="pid file is empty"
        [ -n "$fail" ] || kill -0 "$pid" 2>/dev/null || fail="pid $pid not running"
 
-       if [ -n "$fail" ]; then
+       if [ -n "$fail" ] && [ "$2" != "--quiet" ]; then
                log_failure_msg "Cannot stop $dmninst: $fail"
                return 1
        fi
@@ -262,7 +262,7 @@ all_stop() {
        done
 
        for dmninst in $reversed; do
-               daemon_stop "$dmninst" &
+               daemon_stop "$dmninst" "$1" &
                pids="$pids $!"
        done
        for pid in $pids; do
@@ -350,7 +350,7 @@ frrcommon_main() {
                start)  all_start;;
                stop)   all_stop;;
                restart)
-                       all_stop
+                       all_stop --quiet
                        all_start
                        ;;
                *)      $cmd "$@";;