#!/bin/sh # # $FreeBSD: head/databases/go-carbon/files/go-carbon.in 466198 2018-04-02 05:55:16Z meta $ # # PROVIDE: go-carbon # REQUIRE: LOGIN # BEFORE: securelevel # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable `go-carbon': # # go_carbon_enable="YES" # # optional: # # go_carbon_conf (flags): Set extra flags here. More options in go-carbon(1) # Default is empty "". # go_carbon_user (user): Set user to run go-carbon. # Default is "carbon". . /etc/rc.subr name="go_carbon" rcvar="go_carbon_enable" load_rc_config $name : ${go_carbon_enable:="NO"} : ${go_carbon_user:="carbon"} : ${go_carbon_config:="/usr/local/etc/go-carbon/go-carbon.conf"} pidfile="/var/run/$name.pid" procname="%%PREFIX%%/bin/go-carbon" command=/usr/sbin/daemon command_args="-f -c -p ${pidfile} ${procname} -config ${go_carbon_config}" extra_commands="reload" reload_command="go_carbon_reload" start_precmd="go_carbon_precmd" go_carbon_precmd() { install -o ${go_carbon_user} /dev/null ${pidfile} } carbonapi_reload() { if [ -n "$pid" ]; then kill -HUP $pid echo "go-carbon config reloaded." else echo "go-carbon not running." fi } run_rc_command "$1"