SOURCES: monit.init - check for config syntax
glen
glen at pld-linux.org
Mon Feb 5 18:21:21 CET 2007
Author: glen Date: Mon Feb 5 17:21:21 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- check for config syntax
---- Files affected:
SOURCES:
monit.init (1.13 -> 1.14)
---- Diffs:
================================================================
Index: SOURCES/monit.init
diff -u SOURCES/monit.init:1.13 SOURCES/monit.init:1.14
--- SOURCES/monit.init:1.13 Mon Feb 5 18:05:12 2007
+++ SOURCES/monit.init Mon Feb 5 18:21:15 2007
@@ -12,9 +12,20 @@
# Get service config
[ -f /etc/sysconfig/monit ] && . /etc/sysconfig/monit
+checkconfig() {
+ local out
+ out=$(monit -c /etc/monitrc -t 2>&1)
+ ret=$?
+ if [ $ret != 0 ]; then
+ echo >&2 "$out"
+ exit 1
+ fi
+}
+
start() {
# Check if the service is already running?
if [ ! -f /var/lock/subsys/monit ]; then
+ checkconfig
msg_starting monit
daemon monit -c /etc/monitrc -l syslog -d 60 -s /var/run/monit.state
RETVAL=$?
@@ -45,11 +56,13 @@
stop
;;
restart)
+ checkconfig
stop
start
;;
reload|force-reload)
if [ -f /var/lock/subsys/monit ]; then
+ checkconfig
msg_reloading monit
daemon monit -c /etc/monitrc reload
RETVAL=$?
@@ -58,13 +71,17 @@
exit 7
fi
;;
+ checkconfig)
+ checkconfig
+ echo "Config check OK"
+ ;;
status)
status monit
monit -c /etc/monitrc status
exit $?
;;
*)
- msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|reload|force-reload|checkconfig|status}"
exit 3
esac
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/monit.init?r1=1.13&r2=1.14&f=u
More information about the pld-cvs-commit
mailing list