question

richardw avatar image
richardw asked

Sync time RPI/VenusOS after boot

I have a setup with a RPI/VenusOS, which I power on every 6 hours for 15 minutes to sync data between VenusOS and my home automation system. I use a GSM Hat with a PPP internet connection. The problem I faced was that the time was never synced after startup, since it takes a while to start the PPP connection.

This is my solution, any remarks/suggestions?

1. Install ntpdate using:

opkg install ntpdate

By default rdate is installed but as far as I understood rdate uses a protocol that is depreciated and not supported by the majority of NTP servers.


2. Create a file /data/updatetime.sh:

#!/bin/bash
sleep 60
#check and set time
ntpdate time.google.com

The sleep 60 is to make sure there is enough time to create a PPP internet connection.

3. Make this file executable

chmod 755 /data/updatetime.sh


4. Add to /data/rc.local (runs after VenusOS startup):

nohup /data/updatetime.sh &


Reboot the system.

Richard

Venus OSRaspberry Pi
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

0 Answers