fix(rc.d): use child pidfile + unique procname for colibri-daemon (Sam & Hermes) #17

Merged
clawdie merged 1 commit from fix/rc.d-procname-pidfile into main 2026-06-04 10:38:33 +02:00
Showing only changes of commit 4f4d36b0ea - Show all commits

View file

@ -4,8 +4,8 @@
#
# colibri-daemon runs in the FOREGROUND — it does not self-daemonize or write a
# pidfile. rc.d runs it under daemon(8), which backgrounds it, writes the
# supervisor pidfile, restarts on crash, drops privileges to the colibri user,
# and redirects stdout/stderr (tracing) to a logfile.
# child pidfile (colibri-daemon PID), restarts on crash, drops privileges to
# the colibri user, and redirects stdout/stderr (tracing) to a logfile.
#
# Setup (one-time, as root):
# pw groupadd colibri
@ -48,15 +48,17 @@ load_rc_config $name
pidfile="${colibri_daemon_run_dir}/colibri-daemon.pid"
# Run colibri-daemon under daemon(8): -P supervisor pidfile, -r restart on exit,
# -t process title, -u drop to the colibri user, -o append stdout/stderr to log.
# Run colibri-daemon under daemon(8): -p child pidfile (writes colibri-daemon PID),
# -r restart on exit, -t process title, -u drop to the colibri user, -o append
# stdout/stderr to log.
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -t ${name} -u ${colibri_daemon_user} \
command_args="-p ${pidfile} -r -t ${name} -u ${colibri_daemon_user} \
-o ${colibri_daemon_logfile} ${colibri_daemon_program}"
# rc.subr matches the pidfile's process against ${procname}; that is daemon(8),
# not colibri-daemon, since daemon(8) is the supervised parent.
procname="/usr/sbin/daemon"
# Use the child's process name so rc.subr can find the right process via the
# child pidfile. Using the daemon(8) supervisor path would collide with
# tailscaled and other daemon(8)-managed services on the system.
procname="colibri-daemon"
start_precmd="colibri_daemon_prestart"
start_postcmd="colibri_daemon_poststart"