-#!/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
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
#
#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")
.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 {
-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\
-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)