Attempt to write an rc.d script not working

Rocky Hotas rockyhotas at post.com
Wed Jan 20 18:40:56 UTC 2021


> Sent: Wednesday, January 20, 2021 at 4:57 PM
> From: "RW via freebsd-questions" <freebsd-questions at freebsd.org>
> To: freebsd-questions at freebsd.org
> Subject: Re: Attempt to write an rc.d script not working
>
> daemons do a double fork into the background. nc will run in the
> foreground and block the start command. Probably you should use
> daemon(8) to start nc.

I tried in `Attempt 2' with:

daemon -o /tmp/dummy2_out nc -l 59002

and it works! I can successfully run `service dummy2 start' and the
prompt returns. `nc' is correctly listening on port 59002 and
/tmp/dummy2_out is used.
I can not `stop' the service, but this is maybe due to the fact that a
stop function is not defined in the /etc/rc.d/dummy2 script.

In `Attempt 1', instead, something like

command="/usr/sbin/daemon nc"

does not work. However, it is not important, because it was just a
first attempt/draft.

Thank you so much!

Rocky


More information about the freebsd-questions mailing list