vendredi 27 février 2015

Automatically update hwclock at boot


We're having a small issue with our Beagle Bone Blacks. Since they do not come with a RTC battery, when they lose power, the hardware clock gets messed up. I need a simple and clean way of syncing the hwclock to the system clock on boot. The system clock ofcourse gets its time from ntpd and so after it boots, the system clock is perfect. I'm right there at the solution, just need a few suggestions and a little bit of syntax.


I wanted and tried to add:



/sbin/hwclock --systohc


To /etc/init.d/ntp (inside and at the end of the start case) and at first this seemed to work, but now after a few more tests, its not working anymore., I'm not sure what changed. Maybe I just thought it worked.


I know hwclock -w works great and I know I could do something like put it in a cron job on boot, but I prefer to avoid cron if I can. Any other suggestions or syntax changes?


Thanks


BTW, this is on Debian, but we need this to work on Ubuntu too.



Aucun commentaire:

Enregistrer un commentaire