Hi Steve,
On 17/8/20 12:53, Steve Litt wrote:
> Hi Aitor,
>
> It's very important that there continue to be a way to run
> simple-netaid in the foreground, so runit and s6 and other good inits
> can run it reliably, without kludge.
>
> I can see by your code that your intent was to give the user a choice
> of self-daemonize or foreground, judging by the lines:
>
> 46: static int daemonized_flag = 1;
> and
> 585: if (daemonized_flag == 1) {
>
> but I saw no way for the user to set daemonized_flag to 0. I saw a
> way for the user to reiterate setting it to 1:
>
> 484: {"daemon", no_argument, &daemonized_flag, 1},
>
> If I remember my getopt_long correctly, the preceding line allows
> someone to specify --daemon but not whether it's 1 or 0, and the
> preceding line defaults it to 1.
You are right, there was no way to set this flag to zero.
I've just started making the changes needed (still not tested) and, in
the meantime,
i'm also improving the documentation in the Readme files, focusing the
tutorials to
other distributions using different package management systems.
For example, you can look at the howto of libnetaid:
https://git.devuan.org/aitor_czr/libnetaid
> I'd suggest you add -f and --foreground so the user can set it to
> foreground.
You are suggesting something like:
# snetaid (run in the background - *Default*)
# snetaid -f (run in the foreground)
> Personally, I'd also suggest setting the default to foreground, to
> better fit with inits like runit and s6, which I think some time in the
> future will be Devuan's default init system.
Then, in the other way around we should change the name of the flag to
" --background "
or " --no-foreground ", that is:
# snetaid (run in the foreground - *Default*)
# snetaid --background (run in the background)
Thanks for your help :)
Aitor.