NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Daemonizing processes in NetBSD
Bartek Krawczyk wrote:
> Oh I should have been more clear from the start. This is for rc.d script for
> wip/adguardhome. Probably during startup it doesn't really matter,
I believe you are correct. During boot time all processes start from
the init daemon and will not be attached to a controlling terminal.
So the system upon a fresh reboot should be okay.
> but when I tested it with "service adguardhome onestart" etc. it
> sticks on the console.
Yes. If the original boot time start is stopped and then a new
process is started from your terminal then that new process would
inherit your terminal as a controlling terminal unless it detaches
from it. Detaching is something all well behaved daemons do.
I am not familiar with AdGuardHome at all. It can't be coded to be a
well behaved daemon itself? That would solve the problem at the
source of course.
> I'm not sure installing additional software just for a single rc.d
> script is a feasible solution. "&" works just fine for now and I
> noticed it also in other script.
If you reboot and it starts then it should be fine. Then just don't
ever restart it! That would be fine. Starting a new process that
does not know how to detach from the controlling terminal is the point
where you either need it to know how to call setsid(2) or you need
something else installed on the system which knows how to call
setsid(2).
Or it looks like you would need to install some additional software
outside of base, along with your install of AdGuardHome software that
is also outside of base.
Bob
Home |
Main Index |
Thread Index |
Old Index