summaryrefslogtreecommitdiff
path: root/www/grafana2/files/grafana2.in
blob: 2ef263cc419cc5c6ef55fe13b66116dce24571c3 (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
#!/bin/sh
# $FreeBSD$

# PROVIDE: grafana2
# REQUIRE: DAEMON NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable grafana2b:
# grafana2_enable="YES"
#
# grafana2_enable (bool):	Set to YES to enable grafana2
#				Default: NO
# grafana2_ini (str):		grafana2 configuration file
#				Default: ${PREFIX}/etc/grafana2.conf
# grafana2_user (str):		grafana2 daemon user
#				Default: grafana2
# grafana2_group (str):		grafana2 daemon group
#				Default: grafana2
# grafana2_flags (str):		Extra flags passed to grafana2

. /etc/rc.subr

name="grafana2"
rcvar=grafana2_enable

: ${grafana2_enable:="NO"}
: ${grafana2_homepath:="%%GRAFANA_HOMEDIR%%"}
: ${grafana2_user:="%%GRAFANA_USER%%"}
: ${grafana2_group:="%%GRAFANA_GROUP%%"}
: ${grafana2_flags:=""}
: ${grafana2_ini:="%%PREFIX%%/etc/${name}.ini"}
: ${grafana2_options:="${grafana2b_flags} -homepath=${grafana2_homepath} -config=${grafana2_ini}"}

# daemon
grafana2_pidfile="%%GRAFANA_PIDFILE%%"
procname="%%PREFIX%%/bin/${name}"
command=/usr/sbin/daemon
command_args=" -f -c -p ${grafana2_pidfile} sh -c \\\"${procname} ${grafana2_options} 2>&1| logger -t ${name}\\\""
start_precmd="grafana2_precmd"

grafana2_precmd()
{
    install -o ${grafana2_user} /dev/null ${grafana2_pidfile}
}

load_rc_config $name
run_rc_command "$1"