找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 8733|回复: 30

PPOE拨号到指定网关的脚本,大神们帮看一下

[复制链接]
因为家里拨号每次的网关都不一样,但有一个网关的速度最快,参考指定IP脚本写了个,用的是老毛子固件
#!/bin/sh
SSgateway="221.231.205.100"
gateway=$(nvram get wan_gateway |grep $SSgateway)
if ["$gateway"==""];
  then
    echo "OK"
  else
    echo "NO"
    sleep 5
    restart_wan
  fi
大神们看看这个语法对不对,还有不想用小时脚本,可以加到PPPoE拨号脚本里吗?怎么加,之前玩TT时有个当WAN联机的脚本可以加,OP才玩,不怎么会
我的恩山、我的无线 The best wifi forum is right here.
 楼主| | 显示全部楼层
顶起来
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

支持。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

大哥帮写个 拨号10开头的IP就重拨  上限50次的脚本行么

点评

#!/bin/sh i=50 # Will count (-1) while [ `ifconfig | awk '/ppp0/ {getline;split($0,a,/[:.]/);print a[2]}'` = "10" ] do echo "The public IP does not meet the requirements!" echo "pppd will restar  详情 回复 发表于 2016-6-29 19:14
内网重拨脚本,论坛里有  详情 回复 发表于 2016-6-28 16:22
论坛里有对应脚本。  详情 回复 发表于 2016-6-28 06:48
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
morfell 发表于 2016-6-28 00:21
大哥帮写个 拨号10开头的IP就重拨  上限50次的脚本行么

论坛里有对应脚本。

点评

找不见啊  详情 回复 发表于 2016-6-28 20:32
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
morfell 发表于 2016-6-28 00:21
大哥帮写个 拨号10开头的IP就重拨  上限50次的脚本行么

内网重拨脚本,论坛里有

点评

找不见啊  详情 回复 发表于 2016-6-28 20:33
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

论坛里有对应脚本。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

lm317379829 发表于 2016-6-28 06:48
论坛里有对应脚本。

找不见啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

涛娃子 发表于 2016-6-28 16:22
内网重拨脚本,论坛里有

找不见啊

点评

http://www.right.com.cn/forum/forum.php?mod=viewthread&tid=172193&highlight=%C4%DA%CD%F8  详情 回复 发表于 2016-6-30 15:56
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

看看。。。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

要是脚本就是你贴的这个的话,语法有问题

点评

帮改一下吧,我用ssh,一句句按我这个打,可以运行的,但是nvram shnow命令得不到wan口的所有信息.所以我没成功,现在我就想知道这固件用什么命令获取wan_gateway的ip  详情 回复 发表于 2016-6-30 20:31
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 eyre0950 于 2016-6-29 19:29 编辑
morfell 发表于 2016-6-28 00:21
大哥帮写个 拨号10开头的IP就重拨  上限50次的脚本行么

#!/bin/sh
i=50 # Will count (-1)
while [ `ifconfig | awk  '/ppp0/ {getline;split($0,a,/[:.]/);print a[2]}'` -eq 10 ]
do
echo "The public IP does not meet the requirements!"
echo "pppd will restart...."
killall pppd
/usr/sbin/pppd file /tmp/ppp/options.wan0 >/dev/null 2>&1 & #不知道openwrt的pppd拨号是什么命令
sleep 5
echo "pppd restart!"
let i=i-1
if [ $i -eq 0 ];then
echo "Cycle times to reach the upper limit"
exit 1
fi
done
echo "ok"
exit 0

点评

胡乱把你的代码插到原来的代码中间竟然成了 也谢谢你了  详情 回复 发表于 2016-6-30 22:10
原版脚本是这样 请问能够怎么改啊 老大 #!/bin/sh ### Custom user script ### Called after internal WAN up/down action ### $1 - WAN action (up/down) ### $2 - WAN interface name (e.g. eth3  详情 回复 发表于 2016-6-29 22:06
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

来自手机 | 显示全部楼层
学习免流一起交流
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

eyre0950 发表于 2016-6-29 19:14
#!/bin/sh
i=50 # Will count (-1)
while [ `ifconfig | awk  '/ppp0/ {getline;split($0,a,/[:.]/);pr ...

原版脚本是这样   
请问能够怎么改啊 老大


#!/bin/sh

### Custom user script
### Called after internal WAN up/down action
### $1 - WAN action (up/down)
### $2 - WAN interface name (e.g. eth3 or ppp0)
### $3 - WAN IPv4 address
logger  "运行后WAN上/下活动:" "WAN动作:【$1】,WAN接口名称:【$2】,WANIPv4地址:【$3】"

if [ $1 == "up" ] ; then
    /etc/storage/crontabs_script.sh up &
fi

点评

这个脚本不全吧,只能看出是如果运行脚本后面参数是up的话,运行 /etc/storage/crontabs_script.sh up &,crontabs_scripts.sh不知道是个什么脚本  详情 回复 发表于 2016-6-30 09:55
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

学习一下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-28 21:54

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表