求ADSL动态IP地址扑捉!
发表于:2007-06-09来源:作者:点击数:
标签:
有一脚本: (转贴来自:rinehart) #/bin/sh whiletrue;do ipp=$(ifconfig|grepP-t-P) set$ipp ip=$(cat/home/rugal/ipaddress) if["$2"!="$ip"]; then echo$2/home/rugal/ipaddress mail-s"address"
[email protected]/home/rugal/ipaddress else true fi sleep1m
有一脚本:
(转贴来自:rinehart)
#/bin/sh
while true;do
ipp=$(ifconfig |grep P-t-P)
set $ipp
ip=$(cat /home/rugal/ipaddress)
if [ "$2" != "$ip" ];
then
echo $2 > /home/rugal/ipaddress
mail -s "address"
[email protected] < /home/rugal/ipaddress
else
true
fi
sleep 1m
done
但是ipp=$(ifconfig |grep P-t-P) 不行,也不知道他是在什么SHELL下写的,在FREEBSD中该如何写,用的是虚拟拨号TUN0。谢谢!
| zyme 回复于:2003-05-21 09:56:15
|
ifconfig tun0 | grep inet | cut -d ' ' -f 2
|
| redfox 回复于:2003-05-21 10:19:16
|
有很多行的,哥哥,只能用我的赛~ 
|
| redfox 回复于:2003-05-19 18:10:43
|
我是这么得到的
lastip=`ifconfig | grep '>' | tail -n 1 | awk '{print $2}'`
|
| zkinsz 回复于:2003-05-20 09:18:29
|
谢谢redfox,执行到
if [ "$2" != "$ip" ];
时提示:[!=202.00.100.100]: not found
该怎样修改呢?
|
| zkinsz 回复于:2003-05-20 18:10:52
|
终于找到原因了,是笔误:
[的后面和]符号的前面要有一个空格.
|
| zkinsz 回复于:2003-05-21 00:07:49
|
ifconfig ppp0 | grep inet | cut -d : -f 2 | cut -d ' ' -f 1
无结果,
ifconfig查看,TUN0上的才是动态取得的IP
PPP0上并没有IP。
谢谢了。
|
| xwings 回复于:2003-05-20 23:48:38
|
ifconfig ppp0 | grep inet | cut -d : -f 2 | cut -d ' ' -f 1
this one ?
|
原文转自:http://www.ltesting.net