Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tools/frrcommon.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ daemon_stop() {
is_user_root || exit 1

all=false
sig=INT
# these can't be used at the same time anyway
[ "$2" = "--reallyall" ] && all=true
[ "$2" = "--reload" ] && sig=USR1

pidfile="$V_PATH/$daemon${inst:+-$inst}.pid"
vtyfile="$V_PATH/$daemon${inst:+-$inst}.vty"
Expand All @@ -217,8 +220,14 @@ daemon_stop() {
return 1
fi

debug "kill -2 $pid"
kill -2 "$pid"
if [ "$FRR_COLLECT_CORE" = "1" ]; then
debug "kill -6 $pid"
kill -6 "$pid"
else
debug "kill -$sig $pid"
kill -$sig "$pid"
fi

cnt=1200
while kill -0 "$pid" 2>/dev/null; do
sleep .1
Expand Down
2 changes: 1 addition & 1 deletion tools/frrinit.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ reload)
# NB: This will NOT cause the other daemons to be restarted.
daemon_list enabled_daemons disabled_daemons
watchfrr_options="$watchfrr_options $enabled_daemons"
daemon_stop watchfrr && \
daemon_stop watchfrr --reload && \
daemon_start watchfrr

# If we disable an arbitrary daemon and do reload,
Expand Down
11 changes: 11 additions & 0 deletions watchfrr/watchfrr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,13 @@ static FRR_NORETURN void sigint(void)
exit(0);
}

static FRR_NORETURN void sigusr1(void)
{
zlog_notice("Terminating to handle reload (SIGUSR1)");
systemd_send_status("watchfrr restarting to handle changes in daemons");
exit(0);
}

static int valid_command(const char *cmd)
{
char *p;
Expand Down Expand Up @@ -1352,6 +1359,10 @@ static struct frr_signal_t watchfrr_signals[] = {
.signal = SIGCHLD,
.handler = sigchild,
},
{
.signal = SIGUSR1,
.handler = sigusr1,
},
};

/* clang-format off */
Expand Down
Loading