Openwrt 19.07.1 sync with browser

Is there a feature in OpenWrt 19.07 to synchronize time automatically in the browser when the router device is turned off or rebooted, without NTP-client and internet network. maybe there is a script that I can use to get time automatically from the browser without opening the thread and set the synchronization time to the browser

With LuCI, the feature has been there since I started using it.

image

2 Likes

I mean without opening the luci. my wish at the time the router reboots automatically is the clock in the OpenWrt router is the same as the clock in the browser, and without the internet network

Browser is typically a client program. It's not a service provider. A router cannot actively connect to it to get time service.

2 Likes

my problem is if the clock does not sync wireguard will not automatically connect the internet does not work

Maybe the following thread can be helpful

I have read the link you provided but until now it did not work, I had to manually match the time in the script

Can you share the script?

This works for me on a router without RTC:
https://openwrt.org/docs/guide-user/services/vpn/wireguard/extras#race_conditions

1 Like

So sorry for stupid question (I'm newbee in OpenWRT). But how and where to run it?

1 Like

Great support! Thank you. Can I copy/paste these commands to a file "test.sh" and run the file in SSH by command "sh test.sh"? Will it be the correct method?

test.sh

#!/bin/sh
# Resolve race conditions
cat << "EOF" >> /etc/crontabs/root
* * * * * date -s 2030-01-01; /etc/init.d/sysntpd restart
EOF
uci set system.@system[0].cronloglevel="9"
uci commit system
/etc/init.d/cron restart

Connect to your router with SSH and just copy-paste the entire block of code into the terminal.

1 Like

Ok. Thank you again for quick response. :handshake: I`ve tried and it looks like this method really works. After shutdown or rebooting of the router, wireguard connects.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.