#!/bin/sh # $FreeBSD: head/www/grafana2/files/grafana2.in 403502 2015-12-11 06:24:55Z pi $ # # PROVIDE: grafana2 # REQUIRE: LOGIN # KEYWORD: shutdown # Add the following lines to /etc/rc.conf to enable grafana # grafana_enable="YES" # # grafana2_enable (bool): Set to YES to enable grafana # Default: NO # grafana2_conf (str): grafana configration file # Default: ${PREFIX}/etc/grafana.cfg # grafana2_user (str): grafana daemon user # Default: %%GRAFANA_USER%% # grafana2_group (str): grafana daemon group # Default: %%GRAFANA_GROUP%% . /etc/rc.subr name="grafana2" rcvar=grafana2_enable : ${grafana2_enable:="NO"} : ${grafana2_user:="%%GRAFANA_USER%%"} : ${grafana2_group:="%%GRAFANA_GROUP%%"} : ${grafana2_flags:=""} : ${grafana2_conf:="%%PREFIX%%/etc/${name}.conf"} : ${grafana2_options:="-config=${grafana2_conf} -homepath=%%GRAFANAHOMEDIR%%"} pidfile="%%GRAFANAPIDDIR%%${name}.pid" procname="%%PREFIX%%/bin/grafana-server" command=/usr/sbin/daemon command_args="-f -c -p ${pidfile} ${procname} ${grafana2_options}" start_precmd="grafana_precmd" grafana_precmd() { chown ${grafana2_user}:${grafana2_group} %%GRAFANADATADIR%% chown ${grafana2_user}:${grafana2_group} %%GRAFANALOGDIR%% chown ${grafana2_user}:${grafana2_group} %%GRAFANAHOMEDIR%%data/log/ install -o ${grafana2_user} /dev/null ${pidfile} } load_rc_config $name run_rc_command "$1"