alpha-quadrant/net-analyzer/shinken/files/shinken.initd

58 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# 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}
PIDFILE=${PIDPATH}/${MODULE}
LANG=en_US.UTF8
extra_commands="check"
eval DEBUGFILE="\${${_MODULE}DEBUGFILE}"
eval CONFIGFILE="\${${_MODULE}CFG}"
eval PIDFILE="\${${_MODULE}PID}"
SHINKENM="/usr/bin/shinken-${MODULE}"
NEED="net"
if [ -r "${CONFIGFILE}" ] ; then
tmppid=`grep 'pidfile=' ${CONFIGFILE} | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`
PIDFILE=${tmppid:-$PIDFILE}
fi
if [ $MODULE = "arbiter" ]; then
CONFIGFILE="${CONFIGFILE} --config ${SHINKENSPECIFICCFG}"
fi
depend() {
need net
}
start() {
if [ $SVCNAME = "shinken" ]; then
ebegin "all shinken-services started"
return 0
fi
ebegin "Starting shinken ${MODULE}"
start-stop-daemon --start --exec ${SHINKENM} --quiet --pidfile ${PIDFILE} \
-- --config ${CONFIGFILE} --daemon
eend $?
}
stop() {
if [ $SVCNAME = "shinken" ]; then
ebegin "all shinken-services stopped"
return 0
fi
ebegin "Stopping shinken ${MODULE}"
start-stop-daemon --stop --exec ${SHINKENM} --quiet --pidfile ${PIDFILE}
eend $?
}
check() {
"/usr/bin/shinken-arbiter" -v --config "${ARBITERCFG}" --config "${SHINKENSPECIFICCFG}" $DEBUGCMD 2>&1
return $?
}