1bf87ca2a6
Carbon is a backend data caching and persistence daemon for Graphite. See https://github.com/graphite-project/ for more information.
73 lines
1.2 KiB
Bash
73 lines
1.2 KiB
Bash
#!@RCD_SCRIPTS_SHELL@
|
|
#
|
|
# $NetBSD: carbon-aggregator.sh,v 1.1 2015/12/11 21:40:50 riz Exp $
|
|
#
|
|
# PROVIDE: carbon-aggregator
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
|
|
if [ -f /etc/rc.subr ]; then
|
|
. /etc/rc.subr
|
|
fi
|
|
|
|
name="carbon_aggregator"
|
|
rcvar=$name
|
|
command="@PREFIX@/bin/carbon-aggregator.py"
|
|
config="--config=@PKG_SYSCONFDIR@/carbon.conf"
|
|
graphite_user="@GRAPHITE_USER@"
|
|
graphite_group="@GRAPHITE_GROUP@"
|
|
graphite_dir="@GRAPHITE_DIR@"
|
|
extra_commands="status"
|
|
start_cmd="${name}_start"
|
|
stop_cmd="${name}_stop"
|
|
status_cmd="${name}_status"
|
|
start_precmd='setproclimits'
|
|
|
|
setproclimits()
|
|
{
|
|
local climit
|
|
climit=$(ulimit -n)
|
|
if [ "$climit" -lt 4096 ]; then
|
|
ulimit -n 4096
|
|
fi
|
|
}
|
|
|
|
carbon_aggregator_start()
|
|
{
|
|
@SU@ -m ${graphite_user} -c "${command} ${config} start"
|
|
}
|
|
|
|
carbon_aggregator_stop()
|
|
{
|
|
@SU@ -m ${graphite_user} -c "${command} ${config} stop"
|
|
}
|
|
|
|
carbon_aggregator_status()
|
|
{
|
|
@SU@ -m ${graphite_user} -c "${command} ${config} status"
|
|
}
|
|
|
|
|
|
if [ -f /etc/rc.subr -a -f /etc/rc.conf ]; then
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|
|
else
|
|
if [ -f /etc/rc.conf ]; then
|
|
. /etc/rc.conf
|
|
fi
|
|
case $1 in
|
|
start)
|
|
${start_cmd}
|
|
;;
|
|
stop)
|
|
${stop_cmd}
|
|
;;
|
|
restart)
|
|
${stop_cmd} && ${start_cmd}
|
|
;;
|
|
*)
|
|
@ECHO@ "Usage: $0 {start|stop|restart}" 1>&2
|
|
exit 64
|
|
;;
|
|
esac
|
|
fi
|