Skip to content

Instantly share code, notes, and snippets.

@markizano
Last active August 11, 2020 00:42
Show Gist options
  • Save markizano/d69b105e606a0ae0566210d53d84cae1 to your computer and use it in GitHub Desktop.
Save markizano/d69b105e606a0ae0566210d53d84cae1 to your computer and use it in GitHub Desktop.
Graphite's Carbon Relay init script written for OpenRC
#!/sbin/openrc-run
# 2020-08-10: @markizano
# Written by inference from https://wiki.gentoo.org/wiki/Handbook:X86/Working/Initscripts
# and https://gist.github.com/robinwl/5ec20144364557b83d90
user=${CARBON_USER:-graphite}
group=${CARBON_GROUP:-apps}
description="An init script for Graphite's carbon-cache daemon."
pidfile=${CARBON_PIDFILE:-"/run/carbon-relay.pid"}
command="${CARBON_BIN:-"/usr/local/bin/carbon-relay.py"}"
command_args="--syslog --umask=0022 --config=${CARBON_CONFIGFILE:-"/etc/carbon/carbon-relay.conf"} --pidfile=${pidfile}"
start_stop_daemon_args=${CARBON_SSDARGS:-"--wait 1000"}
retry=${CARBON_TERMTIMEOUT:-"TERM/60/KILL/5"}
depend() {
need net
use dns logger netmount
}
stop_post() {
rm -f ${pidfile}
}
start() {
ebegin "Starting ${DAEMON:-"carbon-relay"}"
${command} ${command_args} start
eend $? "failed"
}
stop() {
ebegin "Stopping ${DAEMON:-"carbon-relay"}"
${command} ${command_args} stop
eend $? "failed"
}
status() {
ebegin "Checking ${DAEMON:-"carbon-relay"}"
${command} ${command_args} status
eend $? ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment