summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4453152)
raw | patch | inline | side by side (parent: 4453152)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Fri, 16 Nov 2012 15:03:41 +0000 (16:03 +0100) | ||
committer | Ruben Kerkhof <ruben@tilaa.nl> | |
Sun, 18 Nov 2012 09:10:38 +0000 (10:10 +0100) |
* checks configuration before (re)starting, based on debian's
initscript
* use /etc/sysconfig instdead of /etc/default
* include optional $ARGS in arguments passed to collectd.
initscript
* use /etc/sysconfig instdead of /etc/default
* include optional $ARGS in arguments passed to collectd.
contrib/redhat/init.d-collectd | patch | blob | history |
index a60acb392e1e25d3a54a93ef59d7a1f6613cac2d..ec55a52a55d75e68613e06b35e989601d0d25bd5 100644 (file)
COLLECTD=/usr/sbin/collectd
COLLECTDMONPID=/var/run/collectdmon.pid
-if [ -r /etc/default/$prog ]; then
- . /etc/default/$prog
+if [ -r /etc/sysconfig/$service ]; then
+ . /etc/sysconfig/$service
fi
+check_config() {
+ if test ! -r "$CONFIG"; then
+ return 2
+ fi
+ if ! $COLLECTD -t -C "$CONFIG"; then
+ return 1
+ fi
+ return 0
+}
+
+
start () {
echo -n $"Starting collectd: "
- if [ -r "$CONFIG" ]
- then
- daemon $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG"
+ check_config
+ rc="$?"
+ if test "$rc" -ne 0; then
+ RETVAL=6
+ echo $"not starting due to configuration error"
+ failure $"not starting $service due to configuration error"
+ else
+ daemon $prog -P $COLLECTDMONPID -c $COLLECTD -- -C "$CONFIG" $ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$service
status $prog
;;
restart|reload)
- stop
- start
+ check_config
+ rc="$?"
+ if test "$rc" -ne 0; then
+ RETVAL=6
+ echo $"not restarting due to configuration error"
+ failure $"not restarting $service due to configuration error"
+ else
+ stop
+ start
+ fi
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :