I’m running on Ubuntu 13.04 and I’m curious how the time-sync is working behind the curtain. The reason for asking is sometimes after powering up the BBB there is no network-connection available. Therefore it takes some stored/saved (?) time from somewhere. So my questions are:
Can I launch the ntp-update after the boot when the network is ready? i.e. don’t execute before the network-connection is established. I guess I have to configure some init-scripts, but I guess at well they should already be there (from Ubuntu?). Since I don’t wanna reinvent the wheel, I am curious about some hints. For the Angstrom-distro I have already a working config, but not for the Ubuntu.
Trying to track down the place from where the time/date is taken in case of network-failure I couldn’t figure it out. The above mentioned place doesn’t work, cause my date after launch is later then THAT /etc/timestamp. So, it must be taken from somewhere else. Any hints?
a) The reason for asking is that I am curious if there is already a process running which writes the time on regular basis in that file. I didn’t find anything in the crontab and guess I have to do it by myself. Anyway, as mentioned above - I don’t wanna reinvent the wheel and ask in advance - just in case…
I'm running on Ubuntu 13.04 and I'm curious how the time-sync is working
behind the curtain. The reason for asking is sometimes after powering up the
BBB there is no network-connection available. Therefore it takes some
stored/saved (?) time from somewhere. So my questions are:
1) Can I launch the ntp-update after the boot when the network is ready?
i.e. don't execute before the network-connection is established. I guess I
have to configure some init-scripts, but I guess at well they should already
be there (from Ubuntu?). Since I don't wanna reinvent the wheel, I am
curious about some hints. For the Angstrom-distro I have already a working
config, but not for the Ubuntu.
ntpdate is installed by default, so if you have a network connection,
it'll eventually update on it's own..
2) Trying to track down the place from where the time/date is taken in case
of network-failure I couldn't figure it out. The above mentioned place
doesn't work, cause my date after launch is later then THAT /etc/timestamp.
So, it must be taken from somewhere else. Any hints?
a) The reason for asking is that I am curious if there is already a process
running which writes the time on regular basis in that file. I didn't find
anything in the crontab and guess I have to do it by myself. Anyway, as
mentioned above - I don't wanna reinvent the wheel and ask in advance - just
in case...
Nope, nothing that advance. When i create the image i set
/etc/timestamp with the current time.. So for end users it'll be at a
most off by a few months, instead of 3 decades.. (in the ballpark)
Can I launch the ntp-update after the boot when the network is ready?
i.e. don’t execute before the network-connection is established. I guess I
have to configure some init-scripts, but I guess at well they should already
be there (from Ubuntu?). Since I don’t wanna reinvent the wheel, I am
curious about some hints. For the Angstrom-distro I have already a working
config, but not for the Ubuntu.
ntpdate is installed by default, so if you have a network connection,
it’ll eventually update on it’s own…
I just checked and see, that most likely there is problem with static interface. I believe this is always up, although no connection to Internet is possible. But this I need to verify …
Trying to track down the place from where the time/date is taken in case
of network-failure I couldn’t figure it out. The above mentioned place
doesn’t work, cause my date after launch is later then THAT /etc/timestamp.
So, it must be taken from somewhere else. Any hints?
a) The reason for asking is that I am curious if there is already a process
running which writes the time on regular basis in that file. I didn’t find
anything in the crontab and guess I have to do it by myself. Anyway, as
mentioned above - I don’t wanna reinvent the wheel and ask in advance - just
in case…
Nope, nothing that advance. When i create the image i set
/etc/timestamp with the current time… So for end users it’ll be at a
most off by a few months, instead of 3 decades… (in the ballpark)
Uhu, I understand somehow that kind of motivation (was mentioned as well in the save_time.sh.).
I made a bash-file which writes the date to the /etc/timestamp file (which I saved under /opt/boot-scripts/save_time.sh)
The reason for using a bash-file was that the crontab didn’t execute the command directly. No real clue and I finally found a workaround. So, I added in the crontab
27 * * * * /opt/boot-scripts/save_time.sh
and now it writes the timestamp properly every hour. Perhaps the file-location is a mess but…
Perhaps this workaround could be added? What do you think?
So, troubled by the same situation and not finding any alternatives, I tried this technique. However, it doesn’t seem to work – at least on my BB Black with the 2015-03-01 build.
In fact, I had a hint that it would not work even before I tried it.
My original /etc/timestamp file had a March 1 date matching the build date, but my /var/log/syslog timestamps on reboot began with March 5 while today’s date is March 15.
I don’t know why the system decided to startup using March 5 as its date.
And after following the suggestion of updating /etc/timestamp using a cron job – I chose once per minute since the /etc/timestamp file captured only hours/minutes (why??) – and confirming that the file was being updated appropriately, after a reboot, I’m back to March 5 until after networking is up and NTP can connect to a server.
So, how DOES the system decide to choose a starting time on reboot???
Updating every minute risks wearing out your emmc flash storage, especially if you do a ‘sync’ afterwards. I used 6 hours, and of course I updated the timestamp at shutdown.