3

I am using my Raspberry Pi with OpenMediaVault, a variant of Debian/Raspian intended for running a NAS server. The web interface for the operating system features a user interface that allows for hardware usage to be tracked using graphs generated by RRDTool that look like this:

RRDTool Graphs in OpenMediaVault

Obviously, the graphs are based on system time. I've noticed that this causes some problems when the Pi is rebooted or booted from a powered off state. When I first check the graphs after a reboot or fresh start, the graphs list a "Last Updated" date of December 2015, and when I force a refresh of the data, the graphs all end up looking like this:

RRDTool Graph Gone Wrong

I understand that this is happening because of the lack of an RTC on the Raspberry Pi, and although one could be acquired, I would like to work around doing so.

To do this, I would like to configure my Pi to sync both its date and time to an NTP server before RRDTool services kick in. Is it possible to achieve something like this?

2

You could use the command ntpdate pool.ntp.org once the network is up (in a script in /etc/network/ip-up.d) and then once a day in root's crontab. If the time difference is too big after 24 hours, you can run it more frequently, like every 6 hours.

  • 1
    Thank you, but how could I stop RRDTool from starting before the sync has completed? – DavidB Jun 29 '16 at 21:27
  • How is that tool started? Is there a script in /etc/init.d? – ott-- Jun 29 '16 at 21:57
  • There are two services that I am looking to delay, and I see scripts with matching names for both of them in /etc/init.d. – DavidB Jun 29 '16 at 22:06
  • The scripts have symlinks to other directories like /etc/rc2.d and /etc/rc3.d, with names starting with Snn where nn ranges from 00 to 99 and S00_xxx is executed first, S99_xxx last. So create a script in /etc/init.d and link it to other directories so your script is executed before the RRDTools.. – ott-- Jun 29 '16 at 22:19
  • You may need to be a bit cautious in trying to reorganise the order in which things are stared up with the __S##__tart and __K##__ill scripts in the /etc/rc#.d - in that since Debian 8 ("Jessie") from which Raspbian is derived the default init sustem is systemd NOT sysV init and, unless you are a curmudgeonly stick-in-the-mud (like myself) you will find yourself using systemd which is a whole different ball-game (or so I understand) about ordering of and interdependence of "sub-systems" and "services" and I wouldn't want to swear that renumbering those scripts is going to work...! 8-) – SlySven Jul 2 '16 at 1:11
1

There is only one way to reach the Stratum-1 servers, and that is to use time.nist.gov which is a pool address all by itself.

It will reach the quickest and most accurate time available on the web.

It will run automatically.

Here is a Q&A on this Stack Exchange that explains how to do it:

How do I set Raspbian to use the primary time server time.nist.gov?

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.