ntpd pidfile
Denys Vlasenko
vda.linux at googlemail.com
Wed Mar 27 13:16:20 UTC 2019
On Tue, Mar 19, 2019 at 6:44 PM Alfonso Ranieri <alforan at tin.it> wrote:
>
> Is there any reason to create the pidfile for ntpd even if with the -n
> option?
>
> It may happen that busybox ntpd is run just to set or test the time with
> a server, while another ntpd is running with its pid file.
>
> I usually use this patch to avoid the creation of the pid file:
>
> diff --git a/networking/ntpd.c b/networking/ntpd.c
> index b2e77929e..434a01258 100644
> --- a/networking/ntpd.c
> +++ b/networking/ntpd.c
> @@ -2641,7 +2641,8 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv)
> */
> cnt = G.peer_cnt * (INITIAL_SAMPLES + 1);
>
> - write_pidfile_std_path_and_ext("ntpd");
> + if (G_listen_fd>=0)
> + write_pidfile_std_path_and_ext("ntpd");
I'm going with:
+ if (!(opts & OPT_n)) /* only if backgrounded: */
+ write_pidfile_std_path_and_ext("ntpd");
More information about the busybox
mailing list