AorryOn 27.02.17 10:19, Matus UHLAR - fantomas wrote:
just for sure, I'm attaching the init script patch (against distributed
version).

sorry: attaching the NEW patch
creating /var/run/smokeping was moved to the from "start" section to
check_config() function, so the config can be checked without smokeping
started, and checking config before start does not fail at boot time.


--
Matus UHLAR - fantomas, [email protected] ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
You have the right to remain silent. Anything you say will be misquoted,
then used against you.
--- smokeping.orig	2013-03-17 01:21:28.000000000 +0100
+++ smokeping	2017-01-19 18:04:27.000000000 +0100
@@ -79,6 +79,7 @@
 }
 
 check_config () {
+    echo "Checking smokeping configuration file syntax..."
     # Check whether the configuration file is available
     if [ ! -r "$CONFIG" ] && [ "$MODE" = "master" ]
     then
@@ -86,12 +87,18 @@
         log_end_msg 6 # program is not configured
         exit 6
     fi
+    if [ ! -d /var/run/smokeping ]; then
+        mkdir /var/run/smokeping
+        chown ${DAEMON_USER}.root /var/run/smokeping
+        chmod 0755 /var/run/smokeping
+    fi
+    ${DAEMON} --config=${CONFIG} --check || exit 6
 }
 
 case "$1" in
     start)
-        log_daemon_msg "Starting $DESC" $NAME
         check_config
+        log_daemon_msg "Starting $DESC" $NAME
         check_slave
         set +e
         pidofproc "$DAEMON" > /dev/null
@@ -104,12 +111,6 @@
             exit $STATUS
         fi
 
-        if [ ! -d /var/run/smokeping ]; then
-            mkdir /var/run/smokeping
-            chown ${DAEMON_USER}.root /var/run/smokeping
-            chmod 0755 /var/run/smokeping
-        fi
-
         set +e
         start-stop-daemon --start --quiet --exec $DAEMON --oknodo \
             --chuid $DAEMON_USER --pidfile $PIDFILE \
@@ -144,9 +145,8 @@
 
 
     reload|force-reload)
-        log_action_begin_msg "Reloading $DESC configuration"
-
         check_config
+        log_action_begin_msg "Reloading $DESC configuration"
         set +e
         $DAEMON --reload $DAEMON_ARGS | logger -p daemon.notice -t smokeping
         STATUS=$?
@@ -161,6 +161,9 @@
         exit $STATUS
         ;;
 
+    check)
+	check_config
+	;;
 
     status)
         log_daemon_msg "Checking $DESC status" $NAME

Reply via email to