SOURCES: syslog-ng.init - improved configtest formatting
glen
glen at pld-linux.org
Mon Jan 26 23:21:39 CET 2009
Author: glen Date: Mon Jan 26 22:21:38 2009 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- improved configtest formatting
---- Files affected:
SOURCES:
syslog-ng.init (1.23 -> 1.24)
---- Diffs:
================================================================
Index: SOURCES/syslog-ng.init
diff -u SOURCES/syslog-ng.init:1.23 SOURCES/syslog-ng.init:1.24
--- SOURCES/syslog-ng.init:1.23 Mon Jan 26 23:02:18 2009
+++ SOURCES/syslog-ng.init Mon Jan 26 23:21:33 2009
@@ -21,8 +21,21 @@
. /etc/sysconfig/syslog-ng
fi
+checkconfig() {
+ syslog-ng $OPTIONS -F -s -p /var/run/syslog-ng-syntaxcheck.pid
+ RETVAL=$?
+ return $RETVAL
+}
+
configtest() {
- syslog-ng $OPTIONS -F -s -p /var/run/syslog-ng-syntaxcheck.pid || exit 1
+ checkconfig 2>/dev/null
+ RETVAL=$?
+ if [ $RETVAL != 0 ]; then
+ show "Checking syslog-ng config syntax"
+ fail
+ echo >&2 "Configuration file syntax test failed. Run $0 configtest to see errors."
+ exit $RETVAL
+ fi
}
start() {
@@ -77,16 +90,10 @@
;;
reload|force-reload)
if [ -f /var/lock/subsys/syslog-ng ]; then
- msg_reloading "syslog-ng"
configtest
+ msg_reloading "syslog-ng"
+ killproc syslog-ng -HUP
RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- killproc syslog-ng -HUP
- RETVAL=$?
- else
- fail
- echo >&2 "Configuration file syntax test failed."
- fi
else
msg_not_running "syslog-ng"
exit 7
@@ -94,21 +101,18 @@
;;
flush-logs)
if [ -f /var/lock/subsys/syslog-ng ]; then
- msg_reloading "syslog-ng"
configtest
+ msg_reloading "syslog-ng"
+ killproc syslog-ng -HUP
RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- killproc syslog-ng -HUP
- RETVAL=$?
- else
- fail
- echo >&2 "Configuration file syntax test failed."
- fi
fi
;;
configtest)
- configtest
- exit $?
+ show "Checking syslog-ng config syntax"
+ res=$(checkconfig 2>&1)
+ RETVAL=$?
+ [ $RETVAL = 0 ] && ok || fail
+ echo >&2 "$res"
;;
status)
status syslog-ng
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/syslog-ng.init?r1=1.23&r2=1.24&f=u
More information about the pld-cvs-commit
mailing list