fix(rc.d): supervisor-aware stop + bring clawdie.in to parity (Sam & Claude) #18

Merged
clawdie merged 1 commit from fix/rc.d-stop-supervisor into main 2026-06-04 10:50:37 +02:00
Owner

Follow-up to #17. Two issues with the daemon(8) -r + child-pidfile pattern:

  1. Stop semantics (both services): with -r, rc.subr's default stop sends
    SIGTERM to the child pid — and the still-running daemon(8) supervisor
    respawns it ~1s later, so service … stop never actually stops it. Fix:
    add a -P supervisor pidfile and a custom stop_cmd that SIGTERMs the
    supervisor (which forwards to the child and exits without restarting),
    waits up to 30s, SIGKILL fallback, then cleans pidfiles. Child pidfile +
    unique procname are kept for accurate start/status.

  2. clawdie.in parity: it still carried the pre-#17 pattern (-P ${pidfile}
    as the only pidfile + procname="/usr/sbin/daemon"), so service clawdie status could match tailscaled/colibri_daemon on a stale pidfile. Brought
    it to the same shape as colibri_daemon.in: child pidfile, procname="clawdie",
    supervisor pidfile, stop_cmd, socket-ready poststart, socket cleanup
    poststop, and a health command.

Packaging-only — no Rust touched, no rebuild needed. sh -n clean on both;
stop algorithm exercised standalone (kills supervisor, idempotent). FreeBSD
start/stop/status/restart validation still owed on OSA.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Follow-up to #17. Two issues with the daemon(8) `-r` + child-pidfile pattern: 1. Stop semantics (both services): with `-r`, rc.subr's default stop sends SIGTERM to the *child* pid — and the still-running daemon(8) supervisor respawns it ~1s later, so `service … stop` never actually stops it. Fix: add a `-P` supervisor pidfile and a custom stop_cmd that SIGTERMs the supervisor (which forwards to the child and exits without restarting), waits up to 30s, SIGKILL fallback, then cleans pidfiles. Child pidfile + unique procname are kept for accurate start/status. 2. clawdie.in parity: it still carried the pre-#17 pattern (`-P ${pidfile}` as the only pidfile + procname="/usr/sbin/daemon"), so `service clawdie status` could match tailscaled/colibri_daemon on a stale pidfile. Brought it to the same shape as colibri_daemon.in: child pidfile, procname="clawdie", supervisor pidfile, stop_cmd, socket-ready poststart, socket cleanup poststop, and a `health` command. Packaging-only — no Rust touched, no rebuild needed. `sh -n` clean on both; stop algorithm exercised standalone (kills supervisor, idempotent). FreeBSD start/stop/status/restart validation still owed on OSA. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clawdie added 1 commit 2026-06-04 10:50:27 +02:00
Follow-up to #17. Two issues with the daemon(8) `-r` + child-pidfile pattern:

1. Stop semantics (both services): with `-r`, rc.subr's default stop sends
   SIGTERM to the *child* pid — and the still-running daemon(8) supervisor
   respawns it ~1s later, so `service … stop` never actually stops it. Fix:
   add a `-P` supervisor pidfile and a custom stop_cmd that SIGTERMs the
   supervisor (which forwards to the child and exits without restarting),
   waits up to 30s, SIGKILL fallback, then cleans pidfiles. Child pidfile +
   unique procname are kept for accurate start/status.

2. clawdie.in parity: it still carried the pre-#17 pattern (`-P ${pidfile}`
   as the only pidfile + procname="/usr/sbin/daemon"), so `service clawdie
   status` could match tailscaled/colibri_daemon on a stale pidfile. Brought
   it to the same shape as colibri_daemon.in: child pidfile, procname="clawdie",
   supervisor pidfile, stop_cmd, socket-ready poststart, socket cleanup
   poststop, and a `health` command.

Packaging-only — no Rust touched, no rebuild needed. `sh -n` clean on both;
stop algorithm exercised standalone (kills supervisor, idempotent). FreeBSD
start/stop/status/restart validation still owed on OSA.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
clawdie merged commit 3aee4637d8 into main 2026-06-04 10:50:37 +02:00
clawdie deleted branch fix/rc.d-stop-supervisor 2026-06-04 10:50:38 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clawdie/colibri#18
No description provided.