All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Weber <matthew.weber@rockwellcollins.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] ntp: added S48ntpdate script
Date: Mon, 22 Oct 2018 18:13:26 -0500	[thread overview]
Message-ID: <CANQCQpZkWNHkDW+hNL9a=mDH+WSC+=2h-JJihfoWmrn7CqB_jw@mail.gmail.com> (raw)
In-Reply-To: <CANQCQpZQy=58rDrKgPP7yN_X3gCLRS4gLDneEcuPVDrVQH0AFA@mail.gmail.com>

Oscar,

On Mon, Oct 22, 2018 at 3:49 AM Matthew Weber
<matthew.weber@rockwellcollins.com> wrote:
>
> Oscar,
>
> On Mon, Oct 22, 2018 at 2:25 AM Oscar Gomez Fuente
> <oscargomezf@gmail.com> wrote:
> >
> > Hi Matthew,
> >
> >
> > Thank you very much for your help.
> >
> > I was checking If the script is working fine:
> > ----->
> > #! /bin/sh
> >
> > NAME=ntpd
> >
> > # Read config file if it is present.
> > if [ -r /etc/default/$NAME ]
> > then
> >         . /etc/default/$NAME
> > fi
> >
> > case "$1" in
> >         start)
> >                 printf "Starting $NAME: "
> >                 CURRENT_DATE=$(date | grep "1970")
> >                 if [ "$CURRENT_DATE" != "" ]; then
> >                         /usr/sbin/ntpd -q -x
> >                         [ $?  != 0 ] && echo -n "(No initial time set) - "
> >                 fi
> >                 start-stop-daemon -S -q -x /usr/sbin/ntpd -- -g
> >                 [ $? = 0 ] && echo "OK" || echo "FAIL"
> >                 ;;
> >         stop)
> >                 printf "Stopping $NAME: "
> >                 start-stop-daemon -K -q -n $NAME
> >                 [ $? = 0 ] && echo "OK" || echo "FAIL"
> >                 ;;
> >         restart|reload)
> >                 echo "Restarting $NAME: "
> >                 $0 stop
> >                 sleep 1
> >                 $0 start
> >                 ;;
> >         *)
> >                 echo "Usage: $0 {start|stop|restart|reload}" >&2
> >                 exit 1
> >                 ;;
> > esac
> >
> > exit 0
> > ----->
> >
> > But it seems to be that the command "/usr/sbin/ntpd -q -x" is not
> > working properly:
> >
> > # date --set "1970-01-10 10:10:00"
> > Sat Jan 10 10:10:00 UTC 1970
> > # /etc/init.d/S49ntp restart
> > Restarting ntpd:
> > Stopping ntpd: OK
> > Starting ntpd: 10 Jan 10:10:04 ntpd[1859]: ntpd 4.2.8p12 at 1.3728-o Thu
> > Oct 18 16:16:56 UTC 2018 (1): Starting
> > 10 Jan 10:10:04 ntpd[1859]: Command line: /usr/sbin/ntpd -q -x
> > 10 Jan 10:10:04 ntpd[1859]: proto: precision = 1.718 usec (-19)
> > 10 Jan 10:10:04 ntpd[1859]: Listen and drop on 0 v6wildcard [::]:123
> > 10 Jan 10:10:04 ntpd[1859]: Listen and drop on 1 v4wildcard 0.0.0.0:123
> > 10 Jan 10:10:04 ntpd[1859]: Listen normally on 2 lo 127.0.0.1:123
> > 10 Jan 10:10:04 ntpd[1859]: Listen normally on 3 eth0 192.168.20.226:123
> > 10 Jan 10:10:04 ntpd[1859]: Listen normally on 4 ppp0 172.21.39.120:123
> > 10 Jan 10:10:04 ntpd[1859]: Listen normally on 5 lo [::1]:123
> > 10 Jan 10:10:04 ntpd[1859]: Listen normally on 6 eth0
> > [xxxx::xxxx:xxxx:xxxx:xxxx%2]:123
> > 10 Jan 10:10:04 ntpd[1859]: Listening on routing socket on fd #23 for
> > interface updates
> > (No initial time set) - OK
> >
> > Notice that I checking the script forcing the date to 1970 with this
> > command. Does anyone any suggestion?
> >

If it's Ok with you, I'll send a v2 patch tonight and include your signed-off.

I fixed the args (should have been -g -q) and added a timeout loop to
manage the fact that unlike ntpdate, ntpd won't return if there is no
network connection or the server can't be reached.

Matt

  reply	other threads:[~2018-10-22 23:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 15:52 [Buildroot] [PATCH 1/1] ntp: added S48ntpdate script Oscar Gomez Fuente
2018-10-19 20:16 ` Matthew Weber
2018-10-22  7:25   ` Oscar Gomez Fuente
2018-10-22  8:49     ` Matthew Weber
2018-10-22 23:13       ` Matthew Weber [this message]
2018-10-23  7:58         ` Oscar Gomez Fuente
2018-10-23 13:11           ` Matthew Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANQCQpZkWNHkDW+hNL9a=mDH+WSC+=2h-JJihfoWmrn7CqB_jw@mail.gmail.com' \
    --to=matthew.weber@rockwellcollins.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.