5 # Required-Start: $local_fs $network $remote_fs $syslog
6 # Required-Stop: $local_fs $network $remote_fs $syslog
7 # Default-Start: 2 3 4 5
9 # Short-Description: start and stop the FRR routing suite
10 # Description: FRR is a routing suite for IP routing protocols like
11 # BGP, OSPF, RIP and others. This script contols the main
15 # This is the main init script for FRR. It mostly wraps frrcommon.sh which
16 # provides the actual functions to start/stop/restart things.
19 if [ -r "/lib/lsb/init-functions" ]; then
20 .
/lib
/lsb
/init-functions
34 if [ -r "$self/frrcommon.sh" ]; then
35 .
"$self/frrcommon.sh"
37 .
"@CFG_SBIN@/frrcommon.sh"
43 watchfrr_options
="$watchfrr_options $daemons"
49 exit ${still_running:-0}
57 watchfrr_options
="$watchfrr_options $daemons"
63 print_status watchfrr || fail
=1
69 if [ ! -x "$RELOAD_SCRIPT" ]; then
70 log_failure_msg
"The frr-pythontools package is required for reload functionality."
74 # systemd doesn't set WATCHDOG_USEC for reload commands.
75 watchfrr_pidfile
="$V_PATH/watchfrr.pid"
76 watchfrr_pid
="`cat \"$watchfrr_pidfile\"`"
77 if [ -d "/proc/$watchfrr_pid" ]; then
78 wdt
="`tr '\0' '\n' < /proc/$watchfrr_pid/environ | grep '^WATCHDOG_USEC='`"
79 wdt
="${wdt#WATCHDOG_USEC=}"
80 [ -n "$wdt" ] && : ${WATCHDOG_USEC:=$wdt}
81 [ -n "$WATCHDOG_USEC" ] && export WATCHDOG_USEC
84 # restart watchfrr to pick up added daemons.
85 # NB: This will NOT cause the other daemons to be restarted.
87 watchfrr_options
="$watchfrr_options $daemons"
88 daemon_stop watchfrr
&& \
91 # make systemd not kill watchfrr after ExecReload completes
92 # 3 goats were sacrificed to restore sanity after coding this
93 watchfrr_pid
="`cat \"$watchfrr_pidfile\"`"
94 if [ -f "/proc/$watchfrr_pid/cgroup" -a -d "/sys/fs/cgroup/systemd" ]; then
95 cg
="`egrep '^[0-9]+:name=systemd:' \"/proc/$watchfrr_pid/cgroup\"`"
99 cgmain
="${cgmain%/.control}"
100 cgmain
="${cgmain%/control}"
102 [ -n "$cg" -a "$cg" != "$cgmain" ] && \
103 echo "$watchfrr_pid" > "/sys/fs/cgroup/systemd/$cgmain/tasks"
106 NEW_CONFIG_FILE
="${2:-$C_PATH/frr.conf}"
107 [ ! -r $NEW_CONFIG_FILE ] && log_failure_msg
"Unable to read new configuration file $NEW_CONFIG_FILE" && exit 1
108 "$RELOAD_SCRIPT" --reload "$NEW_CONFIG_FILE"
113 log_failure_msg
"Unknown command: $1" >&2