Files
ports/sysutils/loki/files/loki.in
T
Robert William Vesterman f0ec4e0714 sysutils/loki: Fix a copy/paste mishap in comments
Several comments in loki's rc.d file referred to "grafana" where they
should have referred to "loki". Looks like a copy/paste mishap from
grafana's rc.d.

Approved by:	portmgr blanket
Fixes:		a96c988a29 sysutils/loki: Add new port
Pull Request:	https://github.com/freebsd/freebsd-ports/pull/466
2025-12-11 13:36:19 +01:00

72 lines
1.7 KiB
Bash

#!/bin/sh
# PROVIDE: loki
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable loki
# loki_enable="YES"
#
# loki_enable (bool):
# Set it to YES to enable loki
# Set to NO by default
# loki_user (string):
# Set user that loki will run under
# Default is "%%LOKI_USER%%"
# loki_group (string):
# Set group that own loki files
# Default is "%%LOKI_GROUP%%"
# loki_config (string)
# Set full path to config file
# Default is "%%PREFIX%%/etc/loki.yaml"
# loki_logfile (string)
# Set full path to log file
# Default is "/var/log/loki/loki.log"
# loki_loglevel (string)
# Set log level. Only log messages with the given severity or above.
# Valid levels: [debug, info, warn, error]
# Default is "warn"
# loki_args (string)
# Set additional command line arguments
# Default is ""
. /etc/rc.subr
name=loki
rcvar=loki_enable
load_rc_config $name
: ${loki_enable:="NO"}
: ${loki_user:="%%LOKI_USER%%"}
: ${loki_group:="%%LOKI_GROUP%%"}
: ${loki_config:="%%PREFIX%%/etc/loki.yaml"}
: ${loki_logfile:="/var/log/loki/loki.log"}
: ${loki_loglevel:="warn"}
pidfile="/var/run/${name}/${name}.pid"
required_files="${loki_config}"
procname="%%PREFIX%%/bin/loki"
command="/usr/sbin/daemon"
command_args="-p ${pidfile} -t ${name} -o ${loki_logfile} \
${procname} \
--config.file=${loki_config} \
--log.level=${loki_loglevel} \
${loki_args}"
start_precmd="loki_start_precmd"
loki_start_precmd()
{
if [ ! -d "/var/run/${name}" ]; then
install -d -m 0750 -o ${loki_user} -g ${loki_group} "/var/run/${name}"
fi
if [ ! -d "/var/log/loki" ]; then
install -d -m 0750 -o ${loki_user} -g ${loki_group} "/var/log/loki"
fi
}
run_rc_command "$1"