From 17f8ca9a9804a97ae18399940262e625291ce368 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 26 Jan 2015 16:07:11 +0100 Subject: [PATCH] Debian : init.d metaproxy reload should check configuration MP-591 Fix logrotate too. That is logrotate will not rotate if configuration is faulty. --- debian/metaproxy.init | 7 ++++++- debian/metaproxy.logrotate | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/debian/metaproxy.init b/debian/metaproxy.init index 67743dd..7c54cc9 100644 --- a/debian/metaproxy.init +++ b/debian/metaproxy.init @@ -88,7 +88,8 @@ do_reload() { # If the daemon can reload its configuration without # restarting (for example, when it is sent a SIGHUP), # then implement that here. - # + + $DAEMON -t $DAEMON_OPTS > /dev/null || return 2 start-stop-daemon --stop --signal USR1 --quiet --retry=5 --pidfile $PIDFILE --name $NAME RETVAL="$?" # Return if daemon could not be stopped @@ -157,6 +158,10 @@ case "$1" in ;; esac ;; + checkconfig) + $DAEMON -t $DAEMON_OPTS > /dev/null || exit 2 + exit 0 + ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; diff --git a/debian/metaproxy.logrotate b/debian/metaproxy.logrotate index ae516f2..cb69b1a 100644 --- a/debian/metaproxy.logrotate +++ b/debian/metaproxy.logrotate @@ -5,6 +5,12 @@ compress delaycompress notifempty + prerotate + if [ -f /var/run/metaproxy.pid ]; then + /etc/init.d/metaproxy checkconfig > /dev/null + + fi + endscript postrotate if [ -f /var/run/metaproxy.pid ]; then /etc/init.d/metaproxy force-reload > /dev/null -- 1.7.10.4