joegreat
Very Senior Member
Well, I still think you have a timing issue: You need to find out when to do the job (wan-start seems to early to me).Could someone please help me out? I tried it for several hours.
I run my ntp-server.sh script in the post-mout user script. Why?
Simple: For dns-crypt (and host-ip) you need Entware! For Entware you need your USB thumb drive to be mounted first - ergo: post-mount is the one to use - just before the Entware start!
This works for me like a charm!
ntp-server.sh:
Code:
#!/bin/sh
#
export TZ=$(cat /etc/TZ)
#
# Wait up to 15 seconds to make sure /opt partition is mounted
#
i=0
while [ $i -le 15 ]
do
if [ -d /opt/tmp ]
then
break
fi
sleep 1
i=`expr $i + 1`
echo $i
done
#
# Now resolve DNS name for NTP server
ntp_name=$(nvram get ntp_server0)
grep "$ntp_name" /etc/hosts > /dev/null 2>&1 || \
for ip in $(/opt/bin/hostip $ntp_name)
do
echo $ip $ntp_name >> /etc/hosts
done
#
# and restart NTP client to eliminate 4-5 mins delay
killall ntp && sleep 1
service restart_ntpc