You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
10 years ago
|
#!/sbin/runscript
|
||
|
# Copyright 1999-2014 Gentoo Foundation
|
||
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
# $Header: /var/cvsroot/gentoo-x86/dev-python/carbon/files/carbon.initd,v 1.1 2014/02/19 16:27:36 ultrabug Exp $
|
||
|
|
||
|
export GRAPHITE_CONF_DIR=/etc/carbon
|
||
|
export GRAPHITE_STORAGE_DIR=/var/lib/carbon
|
||
|
|
||
|
INSTANCE=${SVCNAME/#*.}
|
||
|
if [ "${INSTANCE}" == "${SVCNAME}" ]; then
|
||
|
INSTANCE="a"
|
||
|
fi
|
||
|
|
||
|
PIDFILE="/var/run/${SVCNAME}.pid"
|
||
|
PROGRAMNAME=${SVCNAME/.*}
|
||
|
|
||
|
CARBON_CONFIG=${CARBON_CONFIG:-/etc/carbon/carbon.conf}
|
||
|
|
||
|
depend() {
|
||
|
use net
|
||
|
}
|
||
|
|
||
|
|
||
|
start_pre() {
|
||
|
if [ ! -f ${CARBON_CONFIG} ] ; then
|
||
|
eend "Missing ${CARBON_CONFIG}"
|
||
|
fi
|
||
|
case "${PROGRAMNAME}" in
|
||
|
"carbon-relay" )
|
||
|
[ -f /etc/carbon/relay-rules.conf ] || eend "Missing relay-rules.conf"
|
||
|
;;
|
||
|
"carbon-aggregator" )
|
||
|
[ -f /etc/carbon/aggregation-rules.conf ] || eend "Missing missing aggregation-rules.conf"
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
start() {
|
||
|
ebegin "Starting ${PROGRAMNAME} instance ${INSTANCE}"
|
||
|
start-stop-daemon --start --exec /usr/bin/${PROGRAMNAME}.py \
|
||
|
--pidfile ${PIDFILE} \
|
||
|
-- --pidfile ${PIDFILE} --instance ${INSTANCE} \
|
||
|
--logdir /var/log/carbon/ --config ${CARBON_CONFIG} start >/dev/null
|
||
|
eend $? "Failed to start ${SVCNAME}"
|
||
|
}
|
||
|
|
||
|
stop() {
|
||
|
ebegin "Stopping ${PROGRAMNAME} instance ${INSTANCE}"
|
||
|
start-stop-daemon --stop \
|
||
|
--pidfile ${PIDFILE}
|
||
|
eend $? "Failed to stop ${SVCNAME}"
|
||
|
}
|