blob: 2147fce7ae39555f95b6ec984f8865b5a4d2c3ee (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#!/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 it to YES to enable grafana
# Set to NO by default
# grafana_user (string):
# Set user that grafana will run under
# Default is "%%GRAFANA_USER%%"
# grafana_group (string):
# Set group that own grafana files
# Default is "%%GRAFANA_GROUP%%"
# grafana_config (string)
# Set full path to config file
# Default is "%%PREFIX%%/etc/grafana.conf"
# grafana_homepath (string)
# Set full path to homepath dir
# Default is "%%GRAFANA_HOMEDIR%%"
# grafana_syslog_output_enable (bool)
# Set it to YES to enable stdout/stderr syslog output
# Set to NO by default
# grafana_syslog_output_tag (str)
# Set syslog tag if syslog enabled
# Default is "grafana"
# grafana_args (string)
# Set additional command line arguments
# Default is ""
. /etc/rc.subr
name=grafana
rcvar=grafana_enable
load_rc_config $name
: ${grafana_enable:="NO"}
: ${grafana_user:="%%GRAFANA_USER%%"}
: ${grafana_group:="%%GRAFANA_GROUP%%"}
# TODO: Rename to grafana.ini while moving to grafana8
: ${grafana_config:="%%PREFIX%%/etc/grafana.conf"}
: ${grafana_homepath:="%%GRAFANA_HOMEDIR%%"}
: ${grafana_syslog_output_enable:="NO"}
# TODO: Delete while moving to grafana8
if [ -n "${grafana_conf}" ]; then
grafana_config="${grafana_conf}"
fi
if checkyesno grafana_syslog_output_enable; then
if [ -n "${grafana_syslog_output_tag}" ]; then
grafana_syslog_output_flags="-T ${grafana_syslog_output_tag}"
else
grafana_syslog_output_flags="-T ${name}"
fi
fi
pidfile="/var/run/${name}/${name}.pid"
required_files="${grafana_config}"
procname="%%PREFIX%%/bin/grafana-server"
command="/usr/sbin/daemon"
command_args="-f ${grafana_syslog_output_flags} -p ${pidfile} -t ${name} \
/usr/bin/env ${grafana_env} ${procname} \
-config=${grafana_config} \
-homepath=${grafana_homepath} \
${grafana_args}"
start_precmd="grafana_start_precmd"
grafana_start_precmd()
{
if [ ! -d "/var/run/${name}" ]; then
install -d -m 0750 -o ${grafana_user} -g ${grafana_group} "/var/run/${name}"
fi
}
run_rc_command "$1"
|