summaryrefslogtreecommitdiff
path: root/dev-python/carbon/files/carbon.initd
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-python/carbon/files/carbon.initd
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-python/carbon/files/carbon.initd')
-rw-r--r--dev-python/carbon/files/carbon.initd51
1 files changed, 51 insertions, 0 deletions
diff --git a/dev-python/carbon/files/carbon.initd b/dev-python/carbon/files/carbon.initd
new file mode 100644
index 000000000000..a33a70c60f93
--- /dev/null
+++ b/dev-python/carbon/files/carbon.initd
@@ -0,0 +1,51 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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}"
+}