44net-request(a)hamradio.ucsd.edu wrote:
Subject:
Re: [44net] ampr-ripd 1.8 released
From:
"Marius Petrescu" <marius(a)yo2loj.ro>
Date:
02/12/2014 06:15 AM
To:
"'AMPRNet working group'" <44net(a)hamradio.ucsd.edu>
Hi Rob,
-w is a good idea and I will implement it.
Regarding the daemon function, AFAIK it is not available on all systems and
does not have a standardized behavior.
I wrote the code as portable as possible (e.g. static memory allocations,
minimal needed libraries).
Since the only action on the parent is exit(), I don't think that waiting
time is relevant.
Thank you for your input.
Marius, YO2LOJ
Ok. I think daemon is available on many Unix/Linux-like platforms.
However, it is not a
very complicated function. What you wrote in ampr-ripd is nearly the same, except for
that daemon() closes stdin, stdout and stderr when going to daemon mode.
At least on a debian system, when ampr-ripd is started from a shell script under
/etc/init.d,
and when it does not close the controlling tty, init keeps a process running (startpar)
that
waits until it does that. I think that is part of the logic that prints the OK or FAIL
messages
in the init procedure.
So, you could add some fclose or close calls in that part of the code. (only when
verbose=0)
I used the following workaround before I discovered daemon():
ampr-ripd -options </dev/null >/dev/null 2>&1
Rob