[meta-systemd,v2,2/2] meta-systemd: ntp: Fix starting of ntpdate.service

Submitted by Martin Ertsaas on Oct. 26, 2012, 8:58 a.m.

Details

Message ID 1351241920-15135-2-git-send-email-martiert@gmail.com
State Superseded
Headers show

Commit Message

Martin Ertsaas Oct. 26, 2012, 8:58 a.m.
Make ntpdate.service run ntpdate instead of ntpd, as ntpd is not
necessarily installed. Also make ntpdate require network.target, as
you can not run ntpdate (or ntpd for that matter), without networking.

Signed-off-by: Martin Ertsaas <martiert@gmail.com>
---
 .../recipes-support/ntp/ntp/ntpdate.service        |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta-systemd/meta-oe/recipes-support/ntp/ntp/ntpdate.service b/meta-systemd/meta-oe/recipes-support/ntp/ntp/ntpdate.service
index b2bc632..a48d11d 100644
--- a/meta-systemd/meta-oe/recipes-support/ntp/ntp/ntpdate.service
+++ b/meta-systemd/meta-oe/recipes-support/ntp/ntp/ntpdate.service
@@ -1,10 +1,11 @@ 
 [Unit]
 Description=Network Time Service (one-shot ntpdate mode)
+Requires=network.target
 Before=ntpd.service
 
 [Service]
 Type=oneshot
-ExecStart=/usr/bin/ntpd -q -g -x
+ExecStart=/usr/bin/ntpdate pool.ntp.org
 RemainAfterExit=yes
 
 [Install]

Comments

Enrico Scholz Oct. 26, 2012, 2:35 p.m.
Martin Ertsaas <martiert@gmail.com> writes:

>  Type=oneshot
> -ExecStart=/usr/bin/ntpd -q -g -x
> +ExecStart=/usr/bin/ntpdate pool.ntp.org

This should be made configurable. E.g.

  Environment=NTPHOSTS=pool.ntp.org
  EnvironmentFile=-/etc/sysconfig/ntp.conf
  ExecStart=/usr/bin/ntpdate $NTPHOSTS


Enrico
Ross Burton Oct. 26, 2012, 3:07 p.m.
On 26 October 2012 15:35, Enrico Scholz <enrico.scholz@sigma-chemnitz.de> wrote:
> Martin Ertsaas <martiert@gmail.com> writes:
>
>>  Type=oneshot
>> -ExecStart=/usr/bin/ntpd -q -g -x
>> +ExecStart=/usr/bin/ntpdate pool.ntp.org
>
> This should be made configurable. E.g.
>
>   Environment=NTPHOSTS=pool.ntp.org
>   EnvironmentFile=-/etc/sysconfig/ntp.conf
>   ExecStart=/usr/bin/ntpdate $NTPHOSTS

From http://www.pool.ntp.org/en/vendors.html:

"To allow you to use the pool as the default time service in your
application, we will set you up with special hostnames, for example
0.vendor.pool.ntp.org, 1.vendor.pool.ntp.org, 2.vendor.pool.ntp.org
and 3.vendor.pool.ntp.org.
You must absolutely not use the default pool.ntp.org zone names as the
default configuration in your application or appliance."

Someone -- probably someone on the TSC I suspect as a representative
of the YP -- should register a vendor pool so we can default to
0.yocto.pool.ntp.org or something similar.

Ross
Martin Ertsaas Oct. 26, 2012, 3:36 p.m.
On 10/26/12 17:07, Burton, Ross wrote:
> On 26 October 2012 15:35, Enrico Scholz<enrico.scholz@sigma-chemnitz.de>  wrote:
>> Martin Ertsaas<martiert@gmail.com>  writes:
>>
>>>   Type=oneshot
>>> -ExecStart=/usr/bin/ntpd -q -g -x
>>> +ExecStart=/usr/bin/ntpdate pool.ntp.org
>> This should be made configurable. E.g.
>>
>>    Environment=NTPHOSTS=pool.ntp.org
>>    EnvironmentFile=-/etc/sysconfig/ntp.conf
>>    ExecStart=/usr/bin/ntpdate $NTPHOSTS
>  From http://www.pool.ntp.org/en/vendors.html:
>
> "To allow you to use the pool as the default time service in your
> application, we will set you up with special hostnames, for example
> 0.vendor.pool.ntp.org, 1.vendor.pool.ntp.org, 2.vendor.pool.ntp.org
> and 3.vendor.pool.ntp.org.
> You must absolutely not use the default pool.ntp.org zone names as the
> default configuration in your application or appliance."
>
> Someone -- probably someone on the TSC I suspect as a representative
> of the YP -- should register a vendor pool so we can default to
> 0.yocto.pool.ntp.org or something similar.
>
> Ross
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
That sounds like a good way to do it. Then we can simply use that as the 
default, and have the possibility to use an NTPHOST or something.

Should we leave this until someone registers a pool, or what would be a 
good default pool until someone does it?

- Martin
Ross Burton Oct. 27, 2012, 4:05 p.m.
On 26 October 2012 16:36, Martin Ertsås <martiert@gmail.com> wrote:
> Should we leave this until someone registers a pool, or what would be a good
> default pool until someone does it?

This should be raised with the TSC.  There isn't a good default pool,
if you use pool.ntp.org as a default you are in breach of their terms.

Ross