diff options
author | Donald Sharp <donaldsharp72@gmail.com> | 2022-02-08 20:15:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 20:15:05 +0100 |
commit | 6d30246ef11e1a249dfec0e6245da4968a5b5485 (patch) | |
tree | 1c8d4bb4a1d93f24cdcdfba88b0c8733989cdd11 /tools | |
parent | Merge pull request #10492 from ton31337/feature/pmsi_tnl_type_attr_extra (diff) | |
parent | tools: Stop disabled daemons when doing reload (diff) | |
download | frr-6d30246ef11e1a249dfec0e6245da4968a5b5485.tar.xz frr-6d30246ef11e1a249dfec0e6245da4968a5b5485.zip |
Merge pull request #10445 from ton31337/fix/frr-reload_stop_disabled_daemons
tools: Stop disabled daemons when doing reload
Diffstat (limited to 'tools')
-rw-r--r-- | tools/frrinit.sh.in | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/frrinit.sh.in b/tools/frrinit.sh.in index 539ab7d81..e41f2706e 100644 --- a/tools/frrinit.sh.in +++ b/tools/frrinit.sh.in @@ -77,6 +77,7 @@ reload) # systemd doesn't set WATCHDOG_USEC for reload commands. watchfrr_pidfile="$V_PATH/watchfrr.pid" watchfrr_pid="`cat \"$watchfrr_pidfile\"`" + watchfrr_cmdline="`strings /proc/$watchfrr_pid/cmdline`" if [ -d "/proc/$watchfrr_pid" ]; then wdt="`tr '\0' '\n' < /proc/$watchfrr_pid/environ | grep '^WATCHDOG_USEC='`" wdt="${wdt#WATCHDOG_USEC=}" @@ -86,11 +87,24 @@ reload) # restart watchfrr to pick up added daemons. # NB: This will NOT cause the other daemons to be restarted. - daemon_list daemons - watchfrr_options="$watchfrr_options $daemons" + daemon_list enabled_daemons disabled_daemons + watchfrr_options="$watchfrr_options $enabled_daemons" daemon_stop watchfrr && \ daemon_start watchfrr + # If we disable an arbitrary daemon and do reload, + # disabled daemon is still running and we should stop it. + for daemon in $disabled_daemons; do + if grep -q "$daemon" <<< "$watchfrr_cmdline"; then + daemon_stop "$daemon" & + pids="$pids $!" + fi + done + + for pid in $pids; do + wait "$pid" + done + # make systemd not kill watchfrr after ExecReload completes # 3 goats were sacrificed to restore sanity after coding this watchfrr_pid="`cat \"$watchfrr_pidfile\"`" |