summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/collectd/files/collectd.initd')
-rw-r--r--app-admin/collectd/files/collectd.initd32
1 files changed, 31 insertions, 1 deletions
diff --git a/app-admin/collectd/files/collectd.initd b/app-admin/collectd/files/collectd.initd
index 002620a1b027..3240bfb0732f 100644
--- a/app-admin/collectd/files/collectd.initd
+++ b/app-admin/collectd/files/collectd.initd
@@ -1,18 +1,48 @@
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-admin/collectd/files/collectd.initd,v 1.2 2010/10/10 19:13:04 dilfridge Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-admin/collectd/files/collectd.initd,v 1.3 2010/12/16 17:33:45 dilfridge Exp $
: ${COLLECTD_PIDFILE:='/var/run/collectd.pid'}
: ${COLLECTD_CFGFILE:='/etc/collectd.conf'}
: ${COLLECTD_NICELVL:='5'}
+opts="${opts} configtest"
depend() {
use net
}
+configtest() {
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+checkconfig() {
+ if [[ $(sed '/^$\|^#/d' ${COLLECTD_CFGFILE} | grep -c 'LoadPlugin\w\+oracle') != 0 ]] ; then
+ if [[ -e /etc/env.d/50oracle-instantclient-basic ]] ; then
+ source /etc/env.d/50oracle-instantclient-basic
+ export ORACLE_HOME
+ export TNS_ADMIN
+ else
+ ewarn "Unable to set Oracle environment, Oracle plugin wont work"
+ fi
+ fi
+
+ /usr/sbin/collectd -t -C "${COLLECTD_CFGFILE}" 1>/dev/null 2>&1
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eerror "${SVCNAME} has detected an error in your setup:"
+ /usr/sbin/collectd -t -C "${COLLECTD_CFGFILE}"
+ fi
+
+ return $ret
+}
+
start() {
+ checkconfig || return 1
+
ebegin "Starting collectd"
start-stop-daemon --start \
--nicelevel "${COLLECTD_NICELVL}" --exec /usr/sbin/collectd -- \