[Bug 212829] daemon(8) using -P swallows signals such as SIGHUP instead of propagating them

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 15 Apr 2023 00:22:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212829

--- Comment #8 from Ihor Antonov <ihor@antonovs.family> ---
After reading all comments I take the side of Phillip R. Jaenke (prj)

Different services expect different signals, so creating a mechanism to pass
signals to a child leaves a question "how to signal daemon" open. It is
obviously a bad design.

The ideal solution would be to have a socket that daemon listens for various
commands.
I need to run this idea by kevans to make sure he has no objections for this
work.
This might or might not be considered a scope creep. And if it is - I am going
to spin off a new supervisor daemon. With sockets, config files, blackjack and
hookers :)


In the meanwhile It is possible make `service` to send signal to the child.
There are 2 ways:

1) In your rc script

    pidfile=/path/to/child/pid
    command="/usr/sbin/daemon"
    command_args="--child-pidfile $pidfile ....

rc framework on `service foo reload` should send SIGHUP to the process
identified by $pidfile

2) There is a way to add custom commands to the rc script:

    extra_commands="foobarnate"
    pidfile=/path/to/child/pid
    command="/usr/sbin/daemon"
    command_args="--child-pidfile $pidfile ....

    myservice_foobarnate() {
        kill -SIGUSR1 $pidfile
    }

So you can run `service myservice foobarnate` to execute completely custom
logic.

-- 
You are receiving this mail because:
You are the assignee for the bug.