3

I've got a 64-bit Intel PC running Debian 8 with a capacitor-based clock, which means after 3 days without power the time is lost from the hardware clock. To help work-around this, I was thinking we could use a nearby computer on the LAN (with a better battery-backed RTC) to act as a local NTP server.

On boot, will the PC be able to perform an NTP sync fast enough that by the time the "normal" applications start up (esp. our user applications) they are using the correct time, and we aren't dealing with time discontinuities? Our primary function is data logging, so if we started a log file as 1970 and then had it leap to 2016 that would be catastrophic.

  • You can also look at the raspberry pi board, which has no RTC. It uses the fake-hwclock package to save/restore a reasonable time in a file, until ntp syncs up. – meuh Jun 3 '16 at 15:18
4

There are two things you should do. Make sure ntpd is started as early as possible in the boot sequence, and put an ntp-wait somewhere in the boot sequence before any of your applications start.

Depending on your version of Linux, how you achieve that will vary. You should, however, make your application startup dependant on the ntp-wait finishing.

ntp-wait simply waits for the ntpd daemon to report it is synced.

The right way to do this on Debian 8 would be to configure systemd, and to add a new service for the ntp-wait, which your applications would then be dependant upon.

The easy way to do it, is put an ntp-wait in the startup scripts for your apps.

  • Thanks and sorry for the low-quality question, I've tried to fix it up. I'm running Debian 8. I'll give this a shot! – EnemyBagJones Jun 3 '16 at 14:31
  • No worries, updated my answer. If you need more help on sorting out the systemd stuff, I'm not your man, someone else will need to expand on that 'proper' approach. Me, I'd just cheat and stick the ntp-wait in your startup scripts. – EightBitTony Jun 3 '16 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.