[opensuse] automatic time synching when computer connects to the net
Hello: I am interested if this is possible, and how, in openSUSE 13.1 and 13.2 systems: The computer is mostly offline and is connected to the network for limited periods only (by USB mobile net device). The computer's clock is inaccurate and shows large differences (tens of minutes), which is becoming worse at every bootup. Instead of playing with adjtime etc, I would like the system to synchronize the time automatically with an ntp server when the computer is connected to the network. I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available. Thanks, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 14/12/2016 à 12:50, Istvan Gabor a écrit :
automatically with an ntp server when the computer is connected to the network. I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
I don't think so. openSUSE uses this with ntp for years jdd -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2016-12-14 12:50, Istvan Gabor wrote:
Hello:
I am interested if this is possible, and how, in openSUSE 13.1 and 13.2 systems:
The computer is mostly offline and is connected to the network for limited periods only (by USB mobile net device). The computer's clock is inaccurate and shows large differences (tens of minutes), which is becoming worse at every bootup. Instead of playing with adjtime etc, I would like the system to synchronize the time automatically with an ntp server when the computer is connected to the network.
If you use network manager you can add a script to do things on connect. Just add a script to the directory "/etc/NetworkManager/dispatcher.d". In the second parameter it tells you "up" or "down" (ACTION). See "man NetworkManager" for more info. - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlhROUgACgkQja8UbcUWM1y7PQD/cWlTKC/Ps8NAAcHSri3DFu0R /sCIlan7W6sqmCBqolcA/jSb1HsOtcNbH+nspmQllJc7eC1KSm28vuVmrk+p6RkI =F7cs -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi Istvan,
Hello:
I am interested if this is possible, and how, in openSUSE 13.1 and 13.2 systems:
The computer is mostly offline and is connected to the network for limited periods only (by USB mobile net device). The computer's clock is inaccurate and shows large differences (tens of minutes), which is becoming worse at every bootup. Instead of playing with adjtime etc, I would like the system to synchronize the time automatically with an ntp server when the computer is connected to the network. I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
you could copy the ntpd service file and replace the ntpd start with a script of your own, which checks internet connection in the first place and starts ntpd afterwards. Or you could just switch off ntpd's startup check for timeservers, leave it running all the time and trigger setting the clock with some command line tool like ntpdate.
Thanks,
Istvan
Bye. Michael. -- Michael Hirmke -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/14/2016 02:03 PM, Michael Hirmke wrote:
Hi Istvan,
Hello:
I am interested if this is possible, and how, in openSUSE 13.1 and 13.2 systems:
The computer is mostly offline and is connected to the network for limited periods only (by USB mobile net device). The computer's clock is inaccurate and shows large differences (tens of minutes), which is becoming worse at every bootup. Instead of playing with adjtime etc, I would like the system to synchronize the time automatically with an ntp server when the computer is connected to the network. I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
you could copy the ntpd service file and replace the ntpd start with a script of your own, which checks internet connection in the first place and starts ntpd afterwards.
ntpd has a mod specifically for this ntpd -q
From the man page:
In some cases it may not be practical for ntpd to run continuously. The -q option is intended for this purpose. Setting this option will cause ntpd to exit just after setting the clock for the first time with the configured servers.
If the machine is going to be shut down relativly soon, you wouldn't need to run the daemon. But the best approach might be to run once ntpd with the -q to get the time set correctly, then at some later time, start ntpd normally. Note that you might also need to add the -g option, because if time is off by 1000 seconds or more, ntpd panics and exits.
Or you could just switch off ntpd's startup check for timeservers, leave it running all the time and trigger setting the clock with some command line tool like ntpdate.
According to the man page for ntpdate, Ntpdate will decline to set the computer's clock if ntpd is running. Better to use the ntpd -q option. -- After all is said and done, more is said than done. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
We have a system that is booted every day. We use gpsd to monitor a GPS receiver. We had issues with ntp in this setup. So, we instead use chrony. It works great in a system that is booted and where the time may be off significantly. Unlike ntpd, chrony can be told to to a brute force time change when it first gets a time. After that time changes are more gradual. I cannot say that it will solve your delay problem. But I do know that in our systems, gpsd is not always providing times at system boot, can chrony starts without a delay. When time is eventually available, chrony does it's thing. Your source of time will be on the network. So maybe that will also be an issue for chrony. But I would suggest you give it a shot. If only because it works much better with systems that are continuously restarted and may be off from the correct time by a significant amount. YMMV, as it is said. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Roger Oberholtzer wrote:
We have a system that is booted every day. We use gpsd to monitor a GPS receiver. We had issues with ntp in this setup. So, we instead use chrony. It works great in a system that is booted and where the time may be off significantly.
Unlike ntpd, chrony can be told to to a brute force time change when it first gets a time. After that time changes are more gradual.
Doesn't "ntpd -g" do exactly that ?
Your source of time will be on the network. So maybe that will also be an issue for chrony. But I would suggest you give it a shot. If only because it works much better with systems that are continuously restarted and may be off from the correct time by a significant amount.
I'm surprised ntpd doesn't work in the setting too, but although I use it on my laptop, I've never noticed if it misbehaves when there is no network. -- Per Jessen, Zürich (0.6°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Thu, Dec 15, 2016 at 8:15 AM, Per Jessen <per@computer.org> wrote:
Roger Oberholtzer wrote:
We have a system that is booted every day. We use gpsd to monitor a GPS receiver. We had issues with ntp in this setup. So, we instead use chrony. It works great in a system that is booted and where the time may be off significantly.
Unlike ntpd, chrony can be told to to a brute force time change when it first gets a time. After that time changes are more gradual.
Doesn't "ntpd -g" do exactly that ?
Your source of time will be on the network. So maybe that will also be an issue for chrony. But I would suggest you give it a shot. If only because it works much better with systems that are continuously restarted and may be off from the correct time by a significant amount.
I'm surprised ntpd doesn't work in the setting too, but although I use it on my laptop, I've never noticed if it misbehaves when there is no network.
On my laptop, my network starts when I log in to KDE. So the network is not started when ntp starts. What I see in this case is that the time sync does not happen. I do not see a delay. Just that the time is not set. I use chrony at work in our off-line systems. My laptop, otoh, is standard Tumbleweed. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2016-12-15 08:15, Per Jessen wrote:
I'm surprised ntpd doesn't work in the setting too, but although I use it on my laptop, I've never noticed if it misbehaves when there is no network.
In my laptop I use cron to each hour setup the clock, by calling "/usr/sbin/rcntp ntptimeset". This script in 13.1 calls sntp, but previously I think it used "ntp -q" - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlhSh9MACgkQja8UbcUWM1wofgEAl5hm9k28yGH7y8k7m74gZZVR XnJg9qDS8moEDbN9nUoA/3LYoGXw533fmXqb37RooI6gNgEAhzz0p2wQahXrg8Dc =BcH0 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Istvan Gabor wrote:
I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
Unless something waits for ntpd to be started, that should not be the case. There is probably some clever systemctl command to tell you if anything depends on ntpd. -- Per Jessen, Zürich (0.6°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Thu, 15 Dec 2016 07:50:27 +0100, Per Jessen wrote:
Istvan Gabor wrote:
I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
Unless something waits for ntpd to be started, that should not be the case. There is probably some clever systemctl command to tell you if anything depends on ntpd.
Per and all others: Thank you for your suggestions. I will try first setup ntpd in yast and see if it affects bootup time. In the meantime I will look into network manager. I haven't used network manager so far because I preferred ifconfig and kinternet. Kinternet has been removed in oS 13.2, eventually I have to switch to nm, I guess. Chrony sounds interesting, I will investigate it too. I have another question. In openSUSE 13.1 yast -> Network services -> NTP configuration -> Start NTP Daemon section there is an option "Synchronize without Daemon". Does this set up a chron job running sntp at given intervals? (There's no ntpd in oS 13.1, it has been replaced by sntp.) Maybe this would be the best choice. Yast help doesn't say anything about it, but it says: Start NTP Daemon Select whether to start the NTP daemon now and on every system boot. The NTP daemon resolves host names when initializing. Your network connection must be started before the NTP daemon starts. That's why I thought setting up the daemon may cause delays at boot. Thanks, Istvan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2016-12-15 11:58, Istvan Gabor wrote:
Per and all others:
Thank you for your suggestions. I will try first setup ntpd in yast and see if it affects bootup time. In the meantime I will look into network manager. I haven't used network manager so far because I preferred ifconfig and kinternet. Kinternet has been removed in oS 13.2, eventually I have to switch to nm, I guess. Chrony sounds interesting, I will investigate it too.
Leap does not use ifup, it uses... ugh, can't remember the name just now. Maybe you could hook a script on /etc/sysconfig/network/if-up.d, With NM my script activates when the network connects automatically. I don't know about ifup. It is not typical to use ifup on laptop without permanent network.
I have another question. In openSUSE 13.1 yast -> Network services -> NTP configuration -> Start NTP Daemon section there is an option "Synchronize without Daemon". Does this set up a chron job running sntp at given intervals?
Maybe.
(There's no ntpd in oS 13.1, it has been replaced by sntp.)
Yes, there is ntp in 13.1 minas-tirith:~ # which ntpd /usr/sbin/ntpd minas-tirith:~ # rpm -qf /usr/sbin/ntpd ntp-4.2.6p5-15.16.1.x86_64 minas-tirith:~ # cat /etc/os-release NAME=openSUSE VERSION="13.1 (Bottle)" VERSION_ID="13.1"
Maybe this would be the best choice. Yast help doesn't say anything about it, but it says:
Start NTP Daemon Select whether to start the NTP daemon now and on every system boot. The NTP daemon resolves host names when initializing. Your network connection must be started before the NTP daemon starts.
That's why I thought setting up the daemon may cause delays at boot.
Not unless something else waits for ntp to start and sync. I can't say, but I certainly do not start ntpd on my laptop. - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlhSihgACgkQja8UbcUWM1xL0wEAnNx2rpEqtBCuJZy2llOZmFeS PrILYy3T2M48GrrrTkcBAJ/A03JXyMpzZzFgjNra7h2kfKMuPEmdIoHhuYnrwNgS =Si5Q -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carlos E. R. wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2016-12-15 11:58, Istvan Gabor wrote:
Per and all others:
Thank you for your suggestions. I will try first setup ntpd in yast and see if it affects bootup time. In the meantime I will look into network manager. I haven't used network manager so far because I preferred ifconfig and kinternet. Kinternet has been removed in oS 13.2, eventually I have to switch to nm, I guess. Chrony sounds interesting, I will investigate it too.
Leap does not use ifup, it uses... ugh, can't remember the name just now. Maybe you could hook a script on /etc/sysconfig/network/if-up.d,
wicked - but ifup and ifdown still work.
(There's no ntpd in oS 13.1, it has been replaced by sntp.)
Yes, there is ntp in 13.1
He probably meant 'ntpdate' which was deprecated. -- Per Jessen, Zürich (1.4°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2016-12-15 13:29, Per Jessen wrote:
Carlos E. R. wrote:
(There's no ntpd in oS 13.1, it has been replaced by sntp.)
Yes, there is ntp in 13.1
He probably meant 'ntpdate' which was deprecated.
Yes, there were warnings in the docs for years. But even so, ntpdate is present in 13.1 - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlhSjfYACgkQja8UbcUWM1x2JgD/Xfmj/UjEfeIEUglFEYPzKHAd fxni+HFxcLrhYGzQxsYA+QGIvsVc1dkne7/Afeu40BuOtqhRX2IGbCCgWgZOB0lV =DczL -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/15/2016 04:35 AM, Carlos E. R. wrote:
On 2016-12-15 13:29, Per Jessen wrote:
Carlos E. R. wrote:
(There's no ntpd in oS 13.1, it has been replaced by sntp.)
Yes, there is ntp in 13.1
He probably meant 'ntpdate' which was deprecated.
Yes, there were warnings in the docs for years. But even so, ntpdate is present in 13.1
And it is still present in Leap 42.2. But like I say, ntpdate will do nothing if ntpd is running in daemon mode it: just exits. -- After all is said and done, more is said than done.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 2016-12-15 21:52, John Andersen wrote:
On 12/15/2016 04:35 AM, Carlos E. R. wrote:
On 2016-12-15 13:29, Per Jessen wrote:
Carlos E. R. wrote:
(There's no ntpd in oS 13.1, it has been replaced by sntp.)
Yes, there is ntp in 13.1
He probably meant 'ntpdate' which was deprecated.
Yes, there were warnings in the docs for years. But even so, ntpdate is present in 13.1
And it is still present in Leap 42.2. But like I say, ntpdate will do nothing if ntpd is running in daemon mode it: just exits.
Yes, of course. I think that the init script first calls ntpdate or equivalent, then starts ntpd. At least it was done that way years ago. - -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" (Minas Tirith)) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iF4EAREIAAYFAlhTI8YACgkQja8UbcUWM1zE6AD/UE7LgOrDYRmMSONBNDFPeoCf GP2yW30H8G59Nbi2cv4A/1Ts+czWlLwQqX5PtFQOAkC801NoNPib46aNTvD+pwc6 =lwYC -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Wednesday, 14 December 2016 12:50:01 GMT Istvan Gabor wrote:
Hello:
I am interested if this is possible, and how, in openSUSE 13.1 and 13.2 systems:
The computer is mostly offline and is connected to the network for limited periods only (by USB mobile net device). The computer's clock is inaccurate and shows large differences (tens of minutes), which is becoming worse at every bootup. Instead of playing with adjtime etc, I would like the system to synchronize the time automatically with an ntp server when the computer is connected to the network. I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
Thanks,
Istvan Just a thought, can you set up a current server thats always on to be a local ntp server for the internal network?
-- opensuse:tumbleweed:20161212 Qt: 5.7.0 KDE Frameworks: 5.29.0 KDE Plasma: 5.8.4 kwin5-5.8.4-171.1.x86_64 kmail5-16.08.3-1.1.x86_64 Kernel: 4.8.13-1-default Nouveau: 1.0.13_2.1 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/14/2016 06:50 AM, Istvan Gabor wrote:
Hello:
I am interested if this is possible, and how, in openSUSE 13.1 and 13.2 systems:
The computer is mostly offline and is connected to the network for limited periods only (by USB mobile net device). The computer's clock is inaccurate and shows large differences (tens of minutes), which is becoming worse at every bootup. Instead of playing with adjtime etc, I would like the system to synchronize the time automatically with an ntp server when the computer is connected to the network. I am afraid if I turn on ntp daemon, it causes long delays at boot if net connection isn't available.
I've been using ntp on my notebook computer for years without problem. It's often shut down for extended periods of time and starts right up. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (9)
-
Carlos E. R.
-
ianseeks
-
Istvan Gabor
-
James Knott
-
jdd
-
John Andersen
-
mh@mike.franken.de
-
Per Jessen
-
Roger Oberholtzer