Jack Yaz
Part of the Furniture
Do you find that NTP will often taken longer than 5 minutes to sync, causing some addons to fail to start? If so, please read on for a workaround!
NTP "aggressive" syncing on boot while I thrash out a proper fix
Create /jffs/scripts/ntpbootwatchdog.sh
Create or edit /jffs/scripts/init-start
Make sure both are executable
NTP "aggressive" syncing on boot while I thrash out a proper fix
Create /jffs/scripts/ntpbootwatchdog.sh
Code:
#!/bin/sh
if [ "$(nvram get ntp_ready)" -eq 1 ]; then
/usr/bin/logger -st "ntpbootwatchdog" "NTP is synced, exiting"
else
/usr/bin/logger -st "ntpbootwatchdog" "NTP boot watchdog started..."
ntptimer=0
while [ "$(nvram get ntp_ready)" -eq 0 ] && [ "$ntptimer" -lt 600 ]; do
if [ "$ntptimer" -ne 0 ]; then
/usr/bin/logger -st "ntpbootwatchdog" "Still waiting for NTP to sync..."
fi
killall ntp
killall ntpd
service restart_ntpd
ntptimer=$((ntptimer+30))
sleep 30
done
if [ "$ntptimer" -ge 600 ]; then
/usr/bin/logger -st "ntpbootwatchdog" "NTP failed to sync after 10 minutes - please check immediately!"
exit 1
else
/usr/bin/logger -st "ntpbootwatchdog" "NTP has synced!"
fi
fi
Create or edit /jffs/scripts/init-start
Code:
#!/bin/sh
sh /jffs/scripts/ntpbootwatchdog.sh & #make sure NTP starts
Make sure both are executable
Code:
chmod +x /jffs/scripts/ntpbootwatchdog.sh
chmod +x /jffs/scripts/init-start