Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2021 19:40:53 +0100
From:      Rocky Hotas <rockyhotas@post.com>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Attempt to write an rc.d script not working
Message-ID:  <trinity-27663235-c235-4be0-b4cd-69686edbcdcf-1611168053734@3c-app-mailcom-lxa04>
In-Reply-To: <20210120155747.405915e8@gumby.homeunix.com>
References:  <trinity-9070d165-bd6b-4eac-b2f1-4223e6bdb79e-1611156815575@3c-app-mailcom-lxa02> <20210120155747.405915e8@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Sent: Wednesday, January 20, 2021 at 4:57 PM
> From: "RW via freebsd-questions" <freebsd-questions@freebsd.org>
> To: freebsd-questions@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=3D"/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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?trinity-27663235-c235-4be0-b4cd-69686edbcdcf-1611168053734>