blob: a13889092c52a9223ec82ae4e38214e421248db0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: grafana
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable grafana
# grafana_enable="YES"
#
# grafana_enable (bool): Set to YES to enable grafana
# Default: NO
# grafana_conf (str): grafana configration file
# Default: %%PREFIX%%/etc/grafana.conf
# grafana_user (str): grafana daemon user
# Default: %%GRAFANA_USER%%
# grafana_group (str): grafana daemon group
# Default: %%GRAFANA_GROUP%%
. /etc/rc.subr
name="grafana"
rcvar=grafana_enable
load_rc_config $name
: ${grafana_enable:="NO"}
: ${grafana_user:="%%GRAFANA_USER%%"}
: ${grafana_group:="%%GRAFANA_GROUP%%"}
: ${grafana_flags:=""}
: ${grafana_conf:="%%PREFIX%%/etc/${name}.conf"}
: ${grafana_options:="-config=${grafana_conf} -homepath=%%GRAFANAHOMEDIR%%"}
pidfile="%%GRAFANAPIDDIR%%${name}.pid"
procname="%%PREFIX%%/bin/grafana-server"
command=/usr/sbin/daemon
command_args="-f -c -p ${pidfile} ${procname} ${grafana_options}"
start_precmd="grafana_precmd"
grafana_precmd()
{
chown ${grafana_user}:${grafana_group} %%GRAFANADATADIR%%
chown ${grafana_user}:${grafana_group} %%GRAFANALOGDIR%%
chown ${grafana_user}:${grafana_group} %%GRAFANAHOMEDIR%%data/log/
install -d -o ${grafana_user} %%GRAFANAPIDDIR%%
install -o ${grafana_user} /dev/null ${pidfile}
}
run_rc_command "$1"
|