summaryrefslogtreecommitdiff
path: root/www/grafana2/files/grafana2.in
diff options
context:
space:
mode:
Diffstat (limited to 'www/grafana2/files/grafana2.in')
-rw-r--r--www/grafana2/files/grafana2.in48
1 files changed, 48 insertions, 0 deletions
diff --git a/www/grafana2/files/grafana2.in b/www/grafana2/files/grafana2.in
new file mode 100644
index 0000000..2ef263c
--- /dev/null
+++ b/www/grafana2/files/grafana2.in
@@ -0,0 +1,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"