檢查 pppoe 連線是否正常
#!/bin/sh
set -- `ping -c 5 -t 4 202.145.138.1 | grep loss`
# 202.145.138.1 --> TTN DNS
LOSS=$7
if [ "$LOSS" = "100.0%" ]; then
pkill -9 ppp
sleep 15
ppp -ddial pppoe
fi
檢查 DNS 是否更新
#!/bin/sh
set -- `nslookup monkeybiz.info | grep Address`
DNS=$4
set -- `ifconfig tun0 |grep inet`
tun=$2
if [ "$DNS" = "$tun" ]; then
else
/usr/local/etc/rc.d/ddclient restart
fi
ddclient.conf for dnspark
daemon=1800 # check every 1800 seconds
syslog=yes # log update msgs to syslog
#mail=root # mail all msgs to root
mail-failure=root # mail failed update msgs to root
pid=/var/run/ddclient.pid # record PID in file.
ssl=no # use ssl-support. Works with
## single host update
protocol=dnspark, \
login=login-name, \
password=passwd \
abcdefg.com
use=web, web=ipdetect.dnspark.com, web-skip='Current Address:'
0 comments:
Jump to comment form | comments rss | trackback uri