2011-07-05 23:19:40 +02:00
|
|
|
#!/sbin/runscript
|
2012-04-12 17:09:45 +02:00
|
|
|
# Copyright 1999-2011 Gentoo Foundation
|
2011-07-05 23:19:40 +02:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
# $Header: $
|
|
|
|
|
|
|
|
MODULE=${SVCNAME#*.}
|
|
|
|
_MODULE=$(echo $MODULE | awk '{print toupper($0)}')
|
2011-07-19 14:03:05 +02:00
|
|
|
SHINKEN=${SHINKEN:-/usr/bin/shinken}
|
|
|
|
PIDPATH=${PIDPATH:-/var/run/shinken}
|
2011-07-05 23:19:40 +02:00
|
|
|
PIDFILE=${PIDPATH}/${MODULE}
|
|
|
|
|
|
|
|
LANG=en_US.UTF8
|
2012-04-12 17:09:45 +02:00
|
|
|
extra_commands="check"
|
2011-07-05 23:19:40 +02:00
|
|
|
eval DEBUGFILE="\${${_MODULE}DEBUGFILE}"
|
|
|
|
eval CONFIGFILE="\${${_MODULE}CFG}"
|
|
|
|
eval PIDFILE="\${${_MODULE}PID}"
|
|
|
|
SHINKENM="/usr/bin/shinken-${MODULE}"
|
2012-04-12 17:09:45 +02:00
|
|
|
|
|
|
|
if [ -r "${CONFIGFILE}" ] ; then
|
|
|
|
tmppid=`grep 'pidfile=' ${CONFIGFILE} | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`
|
|
|
|
PIDFILE=${tmppid:-$PIDFILE}
|
|
|
|
fi
|
|
|
|
|
2011-07-05 23:19:40 +02:00
|
|
|
if [ $MODULE = "arbiter" ]; then
|
2012-04-12 17:09:45 +02:00
|
|
|
CONFIGFILE="${CONFIGFILE} --config ${SHINKENSPECIFICCFG}"
|
2011-07-05 23:19:40 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
depend() {
|
2011-07-19 13:31:40 +02:00
|
|
|
need net
|
2012-04-13 13:40:20 +02:00
|
|
|
if [ $SVCNAME = "shinken" ]; then
|
|
|
|
need ${SHINKENSERVICES}
|
|
|
|
fi
|
2011-07-05 23:19:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
2011-07-11 13:01:38 +02:00
|
|
|
if [ $SVCNAME = "shinken" ]; then
|
|
|
|
ebegin "all shinken-services started"
|
|
|
|
return 0
|
|
|
|
fi
|
2012-04-12 17:09:45 +02:00
|
|
|
ebegin "Starting shinken ${MODULE}"
|
|
|
|
start-stop-daemon --start --exec ${SHINKENM} --quiet --pidfile ${PIDFILE} \
|
2011-07-11 13:01:38 +02:00
|
|
|
-- --config ${CONFIGFILE} --daemon
|
|
|
|
eend $?
|
2011-07-05 23:19:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2011-07-11 13:01:38 +02:00
|
|
|
if [ $SVCNAME = "shinken" ]; then
|
|
|
|
ebegin "all shinken-services stopped"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
ebegin "Stopping shinken ${MODULE}"
|
2012-04-12 17:09:45 +02:00
|
|
|
start-stop-daemon --stop --exec ${SHINKENM} --quiet --pidfile ${PIDFILE}
|
2011-07-05 23:19:40 +02:00
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
|
|
|
check() {
|
2012-04-12 17:09:45 +02:00
|
|
|
"/usr/bin/shinken-arbiter" -v --config "${ARBITERCFG}" --config "${SHINKENSPECIFICCFG}" $DEBUGCMD 2>&1
|
2011-07-05 23:19:40 +02:00
|
|
|
return $?
|
|
|
|
}
|
2012-04-13 13:40:20 +02:00
|
|
|
|
|
|
|
# vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet:
|
|
|
|
|