decedion
Occasional Visitor
The /jffs/scripts/wan-start of my router has the next content:
The problem is in next portion of code:
It doesn't work, this is the content of /etc/hosts:
I have executed the script in debug mode and this is the output of that portion of code:
It should work! I don't find where is the problem...
Please, someone sees the error?
Thanks. Regards.
Code:
#!/bin/sh
# 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`
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/sbin/dnscrypt-proxy-hostip $ntp_name)
do
echo $ip $ntp_name >> /etc/hosts
done
# Create hosts file with URLs to block
wget -qO- "http://winhelp2002.mvps.org/hosts.txt" "http://someonewhocares.org/hosts/zero/hosts" "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext&useip=0.0.0.0" | grep -w ^0.0.0.0 | sed $'s/\r$//' | sort -u > /jffs/hosts.adblock
# and restart NTP client to eliminate 4-5 mins delay
killall ntp && sleep 1
service restart_ntpc
service restart_dnsmasq
The problem is in next portion of code:
Code:
# 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/sbin/dnscrypt-proxy-hostip $ntp_name)
do
echo $ip $ntp_name >> /etc/hosts
done
It doesn't work, this is the content of /etc/hosts:
Code:
127.0.0.1 localhost.localdomain localhost
192.168.1.1 router.asus.com
192.168.1.1 www.asusnetwork.net
192.168.1.1 www.asusrouter.com
192.168.1.1 RT-N66U.RT-N66U RT-N66U
I have executed the script in debug mode and this is the output of that portion of code:
Code:
# Now resolve DNS name for NTP server
ntp_name=$(nvram get ntp_server0)
+ nvram get ntp_server0
+ ntp_name=es.pool.ntp.org
grep "$ntp_name" /etc/hosts > /dev/null 2>&1 || \
for ip in $(/opt/sbin/dnscrypt-proxy-hostip $ntp_name)
do
echo "$ip $ntp_name" >> /etc/hosts
done
+ grep es.pool.ntp.org /etc/hosts
+ /opt/sbin/dnscrypt-proxy-hostip es.pool.ntp.org
+ echo 81.184.154.182 es.pool.ntp.org
+ echo 157.88.196.27 es.pool.ntp.org
+ echo 147.83.123.133 es.pool.ntp.org
It should work! I don't find where is the problem...
Please, someone sees the error?
Thanks. Regards.
Last edited: