Package: smokeping
Version: 2.6.8-2+deb7u1
the check_config subrouting used in smokeping's init script does only check
config file for existence. smokeping supports "--check" option for checking
its validity:
# smokeping --config=/etc/smokeping/config --check
Configuration file '/etc/smokeping/config' syntax OK.
It would be useful e.g. when reloading smokeping with error in the script
- smokeping would not reload (and thus exit).
modifying the script to check syntat prior to showing messages is
apparently needed.
I am including patch that adds the functionality:
--- 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
--
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.
10 GOTO 10 : REM (C) Bill Gates 1998, All Rights Reserved!