From 2469a37fd083349f658da735cf4011629f85d68b Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Sun, 5 Dec 2021 23:06:16 -0500 Subject: [PATCH] tools: print daemon start cmd, vtysh_b cmd When starting a daemon, print the full command run by the init script to start it. This gives more information and is especially helpful when debugging wrap commands. Also add some more logs to vtysh_b to print the command used there, log when we exit early because frr.conf doesn't exist, and simplify the code path for creating the command to use. Signed-off-by: Quentin Young --- tools/frrcommon.sh.in | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in index e5286d14f6..a610e56d3b 100755 --- a/tools/frrcommon.sh.in +++ b/tools/frrcommon.sh.in @@ -73,12 +73,16 @@ chownfrr() { vtysh_b () { [ "$1" = "watchfrr" ] && return 0 - [ -r "$C_PATH/frr.conf" ] || return 0 - if [ -n "$1" ]; then - "$VTYSH" `echo $nsopt` -b -d "$1" - else - "$VTYSH" `echo $nsopt` -b + if [ -r "$C_PATH/frr.conf" ]; then + log_warning_msg "$C_PATH/frr.conf does not exist; skipping config apply" + return 0 fi + + cmd="$VTYSH `echo $nsopt` -b" + [ -n "$1" ] && cmd+=" -d $1" + + log_success_msg "Sending config with '$cmd'" + eval "$cmd" } daemon_inst() { @@ -176,7 +180,9 @@ daemon_start() { instopt="${inst:+-n $inst}" eval args="\$${daemon}_options" - if eval "$all_wrap $wrap $bin $nsopt -d $frr_global_options $instopt $args"; then + cmd="$all_wrap $wrap $bin $nsopt -d $frr_global_options $instopt $args" + log_success_msg "Starting $daemon with command: '$cmd'" + if eval "$cmd"; then log_success_msg "Started $dmninst" if $all; then debug "Skipping startup of vtysh until all have started" -- 2.39.5