From f0cccaa6bf7dda71d0e1ad1b0406a9b453a84bb3 Mon Sep 17 00:00:00 2001 From: Martin Buck Date: Tue, 31 May 2022 14:16:34 +0200 Subject: [PATCH] tools: Don't complain about missing PID files when stopping all damons Since 1686b1d4864384ee508b58418f20970f2dff2587, we try to stop all daemons, even those which are not (no longer) enabled in /etc/frr/daemons. But we shouldn't complain about missing PID files for daemons which have never been started and just silently ignore those. Signed-off-by: Martin Buck --- tools/frrcommon.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in index 4683ceef14..8ae81bc64c 100644 --- a/tools/frrcommon.sh.in +++ b/tools/frrcommon.sh.in @@ -194,10 +194,14 @@ daemon_stop() { is_user_root || exit 1 + all=false + [ "$1" = "--all" ] && { all=true; shift; } + pidfile="$V_PATH/$daemon${inst:+-$inst}.pid" vtyfile="$V_PATH/$daemon${inst:+-$inst}.vty" [ -r "$pidfile" ] || fail="pid file not found" + $all && [ -n "$fail" ] && return 0 [ -z "$fail" ] && pid="`cat \"$pidfile\"`" [ -z "$fail" -a -z "$pid" ] && fail="pid file is empty" [ -n "$fail" ] || kill -0 "$pid" 2>/dev/null || fail="pid $pid not running" @@ -273,7 +277,7 @@ all_stop() { done for dmninst in $reversed; do - daemon_stop "$dmninst" "$1" & + daemon_stop --all "$dmninst" "$1" & pids="$pids $!" done for pid in $pids; do -- 2.39.5