Files
lixen 71d1b82f83
Test / test (push) Canceled after 0s
Test / e2e (push) Canceled after 0s
v0.22.0 several enhancements and fixes for security, network, doc, test, packaging
2026-10-03 14:52:16 -04:00

48 lines
1.6 KiB
Bash

#!/bin/sh
# PROVIDE: logwisp
# REQUIRE: LOGIN NETWORKING
# KEYWORD: shutdown
# Add to /etc/rc.conf (sysrc logwisp_enable=YES):
# logwisp_enable "YES" starts LogWisp at boot (default "NO")
# logwisp_config configuration file (default %%PREFIX%%/etc/logwisp/logwisp.toml)
# logwisp_user account lw runs as (default "logwisp")
# logwisp_chdir working directory (default /var/db/logwisp)
# logwisp_args extra lw options, e.g. --logging.level=debug (default empty);
# rc.subr hands logwisp_flags to daemon(8), not to lw
. /etc/rc.subr
name=logwisp
rcvar=logwisp_enable
desc="LogWisp log transport"
load_rc_config $name
: ${logwisp_enable:="NO"}
: ${logwisp_config:="%%PREFIX%%/etc/logwisp/logwisp.toml"}
: ${logwisp_user:="logwisp"}
: ${logwisp_chdir:="/var/db/logwisp"}
: ${logwisp_args:=""}
# daemon(8) records the child's pid, so stop and reload (SIGHUP) signal lw
# itself, and sends its output to syslog under the tag logwisp.
pidfile="/var/run/${name}/${name}.pid"
procname="%%BINDIR%%/lw"
command="/usr/sbin/daemon"
command_args="-f -S -T ${name} -p ${pidfile} ${procname} -c ${logwisp_config} ${logwisp_args}"
required_files="${logwisp_config}"
extra_commands="reload"
start_precmd="${name}_prestart"
# rc.subr starts daemon(8) as logwisp_user, which must own the pidfile directory.
# An existing logwisp_chdir keeps its owner: it may be a shared directory.
logwisp_prestart()
{
install -d -o "${logwisp_user}" -m 0755 "/var/run/${name}"
[ -d "${logwisp_chdir}" ] || install -d -o "${logwisp_user}" -m 0750 "${logwisp_chdir}"
}
run_rc_command "$1"