Hello,

On 12.12.16 08:15, Antoine Beaupré wrote:
Thanks for the patch, it looks good and reasonable!

just for sure, I'm attaching the init script patch (against distributed
version).

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.
42.7 percent of all statistics are made up on the spot.
--- smokeping	2016-12-12 12:50:06.000000000 +0100
+++ /etc/init.d/smokeping	2016-12-12 13:16:07.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,13 @@
         log_end_msg 6 # program is not configured
         exit 6
     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
@@ -144,9 +146,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 +162,9 @@
         exit $STATUS
         ;;
 
+    check)
+	check_config
+	;;
 
     status)
         log_daemon_msg "Checking $DESC status" $NAME

Reply via email to