2011-07-05 23:19:40 +02:00
|
|
|
#!/sbin/runscript
|
|
|
|
# Copyright 1999-2010 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}
|
2011-07-05 23:19:40 +02:00
|
|
|
PIDFILE=${PIDPATH}/${MODULE}
|
|
|
|
|
|
|
|
LANG=en_US.UTF8
|
|
|
|
opts="${opts} check"
|
|
|
|
eval DEBUGFILE="\${${_MODULE}DEBUGFILE}"
|
|
|
|
eval CONFIGFILE="\${${_MODULE}CFG}"
|
|
|
|
eval PIDFILE="\${${_MODULE}PID}"
|
|
|
|
SHINKENM="/usr/bin/shinken-${MODULE}"
|
|
|
|
if [ $MODULE = "arbiter" ]; then
|
2011-07-11 13:01:38 +02:00
|
|
|
CONFIGFILE="${SHINKENCFG} --config ${SHINKENSPECIFICCFG}"
|
2011-07-05 23:19:40 +02:00
|
|
|
fi
|
2011-07-19 14:03:05 +02:00
|
|
|
NEED="net"
|
2011-07-19 13:31:40 +02:00
|
|
|
PIDFILE=$(grep '^pidfile=' ${CONFIGFILE} | awk -F= '{ print $2 }')
|
2011-07-05 23:19:40 +02:00
|
|
|
|
|
|
|
depend() {
|
2011-07-19 13:31:40 +02:00
|
|
|
need net
|
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
|
|
|
|
ebegin "starting shinken ${MODULE}"
|
2011-07-19 13:31:40 +02:00
|
|
|
start-stop-daemon --start --exec ${SHINKENM} --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}"
|
2011-07-05 23:19:40 +02:00
|
|
|
start-stop-daemon --stop --exec ${SHINKENM} --pidfile ${PIDFILE}
|
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
|
|
|
check() {
|
|
|
|
"$BIN/shinken-arbiter" -v -c "$SHINKENCFG" -c "$SHINKENSPECIFICCFG" $DEBUGCMD 2>&1
|
|
|
|
return $?
|
|
|
|
}
|