#!/bin/sh # # $FreeBSD: head/net-mgmt/statsd/files/statsd.in 337198 2013-12-22 16:25:58Z swills $ # # PROVIDE: statsd # REQUIRE: NETWORK # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable mysql: # statsd_enable (bool): Set to "NO" by default. # Set it to "YES" to enable statsd. # statsd_config (str): Default to "%%PREFIX%%/etc/statsd.js" # Statsd configuration file. # statsd_user (str): Default to "statsd". # User to run as. . /etc/rc.subr name=statsd rcvar=statsd_enable load_rc_config $name # set defaults : ${statsd_enable:=NO} : ${statsd_config="%%PREFIX%%/etc/statsd.js"} : ${statsd_user="%%USERS%%"} pidfile="/var/run/statsd/${name}.pid" required_files="${statsd_config}" command=/usr/sbin/daemon command_args="-cf -p ${pidfile} %%PREFIX%%/bin/node %%DATADIR%%/stats.js ${statsd_config}" procname="${name}" stop_postcmd="rm -f $pidfile" start_precmd="install -d -o statsd -g statsd ${pidfile%/*}" run_rc_command "$1"