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 <qlyoung@nvidia.com>
This commit is contained in:
Quentin Young 2021-12-05 23:06:16 -05:00 committed by Donald Sharp
parent 66edf91772
commit 2469a37fd0

View file

@ -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"