diff --git a/packaging/freebsd/colibri_daemon.in b/packaging/freebsd/colibri_daemon.in index 84c9fbb..57c526b 100644 --- a/packaging/freebsd/colibri_daemon.in +++ b/packaging/freebsd/colibri_daemon.in @@ -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"