diff options
Diffstat (limited to 'app-metrics/carbonapi-booking/files/carbonapi-booking.initd')
-rw-r--r-- | app-metrics/carbonapi-booking/files/carbonapi-booking.initd | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app-metrics/carbonapi-booking/files/carbonapi-booking.initd b/app-metrics/carbonapi-booking/files/carbonapi-booking.initd new file mode 100644 index 000000000000..c52069a77666 --- /dev/null +++ b/app-metrics/carbonapi-booking/files/carbonapi-booking.initd @@ -0,0 +1,43 @@ +#!/sbin/openrc-run +# Copyright 1999-2023 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Graphite whisper metrics renderer." + +carbonapi_config=${CONFIG_FILE:-/etc/carbonapi/${SVCNAME}.yaml} + +command="/usr/bin/carbonapi" +command_args="-config ${carbonapi_config}" +pidfile="/run/carbonapi/${SVCNAME}.pid" +user=${USER:-carbon} +group=${GROUP:-carbon} + +depend() { + need net + use dns +} + +start_pre() { + mkdir -p "${pidfile%/*}" + chown ${user}:${group} "${pidfile%/*}" +} + +stop_post() { + rm -f "${pidfile}" +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --pidfile "${pidfile}" \ + --make-pidfile --background \ + --user ${user} --group ${group} \ + --exec ${command} -- \ + ${command_args} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec ${command} --pidfile "${pidfile}" + eend $? +} |