]> git.proxmox.com Git - mirror_frr.git/commitdiff
watchfrr: build in defaults for -r/-s/-k
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 24 Jan 2019 17:17:40 +0000 (18:17 +0100)
committerDavid Lamparter <equinox@diac24.net>
Tue, 19 Feb 2019 20:34:31 +0000 (21:34 +0100)
There's no good reason to not have these options default to the
installation path of tools/watchfrr.sh.  Doing so allows us to ditch
watchfrr_options from daemons/daemons.conf completely.

Fixes: #3652
Signed-off-by: David Lamparter <equinox@diac24.net>
configure.ac
tools/etc/frr/daemons
tools/frrcommon.sh.in
tools/frrinit.sh.in
tools/watchfrr.sh.in
watchfrr/watchfrr.c

index 8ae1a7bbc689febf9a3ea5fce93f4d78b99f04df..4a05c0d69ac7e210e13b175d59396cd7bcad388c 100755 (executable)
@@ -2157,6 +2157,7 @@ AC_SUBST([CFG_LIBYANG_PLUGINS])
 AC_DEFINE_UNQUOTED([MODULE_PATH], ["$CFG_MODULE"], [path to modules])
 AC_DEFINE_UNQUOTED([YANG_MODELS_PATH], ["$CFG_YANGMODELS"], [path to YANG data models])
 AC_DEFINE_UNQUOTED([LIBYANG_PLUGINS_PATH], ["$CFG_LIBYANG_PLUGINS"], [path to libyang plugins])
+AC_DEFINE_UNQUOTED([WATCHFRR_SH_PATH], ["${CFG_SBIN%/}/watchfrr.sh"], [path to watchfrr.sh])
 
 dnl ------------------------------------
 dnl Enable RPKI and add librtr to libs
index 2d56fe1b988b272082c3c034d335296f2f6c30de..0fca541137d51d0ccc9d5c0a00626103342650ae 100644 (file)
@@ -55,7 +55,7 @@ bfdd_options="   -A 127.0.0.1"
 fabricd_options="-A 127.0.0.1"
 
 # The list of daemons to watch is automatically generated by the init script.
-watchfrr_options="-r '/usr/lib/frr/watchfrr.sh restart %s' -s '/usr/lib/frr/watchfrr.sh start %s' -k '/usr/lib/frr/watchfrr.sh stop %s'"
+#watchfrr_options=""
 
 # for debugging purposes, you can specify a "wrap" command to start instead
 # of starting the daemon directly, e.g. to use valgrind on ospfd:
index 588aa6d103e10a086c3e1dcedeb63114fb53adf2..37abfeb30d2eec16c1b92d58f2bb6cdab598cd5d 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # This is a "library" of sorts for use by the other FRR shell scripts.  It
 # has most of the daemon start/stop logic, but expects the following shell
@@ -288,6 +288,13 @@ load_old_config "$C_PATH/daemons.conf"
 load_old_config "/etc/default/frr"
 load_old_config "/etc/sysconfig/frr"
 
+if declare -p watchfrr_options | grep -q '^declare \-a'; then
+       log_warning_msg "watchfrr_options contains a bash array value." \
+               "The configured value is intentionally ignored since it is likely wrong." \
+               "Please remove or fix the setting."
+       unset watchfrr_options
+fi
+
 #
 # other defaults and dispatch
 #
index 3dddf5bd448425ea33f4db328ad74049d389ed23..0f5ed85864e71002df40e1801b919e37bd8fc4de 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 ### BEGIN INIT INFO
 # Provides: frr
index 3051d910448c49d64aba553e03d81b86061b7eb7..712f962a0ae57a7e2bffc343d41e1b8c100dcf95 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # This is NOT the init script!  This is the watchfrr start/stop/restart
 # command handler, passed to watchfrr with the -s/-r/-k commands.  It is used
index 2a0b6d890c195d5f0937ae684fd7f15179f0bf18..34f8dabdf14634386c9611334e19430fece8a56b 100644 (file)
 #define DEFAULT_MIN_RESTART    60
 #define DEFAULT_MAX_RESTART    600
 
+#define DEFAULT_RESTART_CMD    WATCHFRR_SH_PATH " restart %s"
+#define DEFAULT_START_CMD      WATCHFRR_SH_PATH " start %s"
+#define DEFAULT_STOP_CMD       WATCHFRR_SH_PATH " stop %s"
+
 #define PING_TOKEN     "PING"
 
 DEFINE_MGROUP(WATCHFRR, "watchfrr")
@@ -124,6 +128,9 @@ static struct global_state {
        .loglevel = DEFAULT_LOGLEVEL,
        .min_restart_interval = DEFAULT_MIN_RESTART,
        .max_restart_interval = DEFAULT_MAX_RESTART,
+       .restart_command = DEFAULT_RESTART_CMD,
+       .start_command = DEFAULT_START_CMD,
+       .stop_command = DEFAULT_STOP_CMD,
 };
 
 typedef enum {
@@ -227,14 +234,17 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n",
 -r, --restart  Supply a Bourne shell command to use to restart a single\n\
                daemon.  The command string should include '%%s' where the\n\
                name of the daemon should be substituted.\n\
+               (default: '%s')\n\
 -s, --start-command\n\
                Supply a Bourne shell to command to use to start a single\n\
                daemon.  The command string should include '%%s' where the\n\
                name of the daemon should be substituted.\n\
+               (default: '%s')\n\
 -k, --kill-command\n\
                Supply a Bourne shell to command to use to stop a single\n\
                daemon.  The command string should include '%%s' where the\n\
                name of the daemon should be substituted.\n\
+               (default: '%s')\n\
     --dry      Do not start or restart anything, just log.\n\
 -p, --pid-file Set process identifier file name\n\
                (default is %s/watchfrr.pid).\n\
@@ -247,7 +257,9 @@ Otherwise, the interval is doubled (but capped at the -M value).\n\n",
 -h, --help     Display this help and exit\n",
                frr_vtydir, DEFAULT_LOGLEVEL, LOG_EMERG, LOG_DEBUG, LOG_DEBUG,
                DEFAULT_MIN_RESTART, DEFAULT_MAX_RESTART, DEFAULT_PERIOD,
-               DEFAULT_TIMEOUT, DEFAULT_RESTART_TIMEOUT, frr_vtydir);
+               DEFAULT_TIMEOUT, DEFAULT_RESTART_TIMEOUT,
+               DEFAULT_RESTART_CMD, DEFAULT_START_CMD, DEFAULT_STOP_CMD,
+               frr_vtydir);
 }
 
 static pid_t run_background(char *shell_cmd)