Jack Yaz
Part of the Furniture
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
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
killall ntp
killall ntpd
service restart_ntpd
ntptimer=$((ntptimer+30))
sleep 30
/usr/bin/logger -st "ntpbootwatchdog" "Still waiting for NTP to sync..."
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
Last edited: