start, restart and reload will now be prohibited if the configuration
file has an incorrect syntax. This avoids killing a running daemon and
is showing an indication to the user instead of having the daemon dying
silently in the background.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
TARGET = $(DIR_INFO)/$(THISAPP)
SUP_ARCH = x86_64
PROG = dnsdist
-PAK_VER = 8
+PAK_VER = 9
DEPS =
[ -r "/etc/sysconfig/dnsdist" ] && . /etc/sysconfig/dnsdist
+check_config() {
+ if ! /usr/bin/dnsdist --check-config >/dev/null; then
+ boot_mesg "dnsdist configuration file contains errors" "${FAILURE}"
+ echo_failure
+ return 1
+ fi
+
+ return 0
+}
+
case "${1}" in
start)
+ if ! check_config; then
+ exit 1
+ fi
+
boot_mesg "Starting dnsdist..."
# Increasing maximum number of open files
;;
reload)
+ if ! check_config; then
+ exit 1
+ fi
+
boot_mesg "Reloading dnsdist..."
reloadproc /usr/bin/dnsdist
;;
restart)
+ if ! check_config; then
+ exit 1
+ fi
+
${0} stop
sleep 1
${0} start