找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2857|回复: 12

分享个自己用的切换AP代码

[复制链接]
发表于 2016-4-29 18:08 | 显示全部楼层 |阅读模式
  1. #!/bin/ash
  2. AP="/etc/AP"
  3. max=4
  4. if [ -f "$AP" ]; then
  5.         num=`cat $AP`
  6. else
  7.         echo "1">$AP
  8.         num=1
  9. fi

  10. if [ $num -eq $max ]; then
  11. echo "1">$AP
  12. num=1
  13. fi

  14. wget -4 --spider --quiet --tries=5 --timeout=5 www.baidu.com
  15. if [ "$?" == "0" ]; then
  16.         echo Network OK!
  17.         exit 0
  18. else
  19.         echo Network Error,try AP$num,Please wait...
  20.         uci import wireless -f /etc/autoap/AP$num
  21.         uci commit wireless
  22.         /etc/init.d/network restart
  23.         echo $(($num+1))>$AP
  24. fi
复制代码
说明:自己新建个文件,把代码拷进去,给个执行权限.保存能正常联网的wireless文件为AP1 2 3....到/etc/autoap/或者自己喜欢的目录,max是AP总数加1,然后定时任务就可以了...

评分

参与人数 1恩山币 +1 收起 理由
春暖花开 + 1 城会玩

查看全部评分

我的恩山、我的无线 The best wifi forum is right here.
发表于 2016-4-29 18:27 | 显示全部楼层
感谢分享!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-4-29 20:16 来自手机 | 显示全部楼层
那些中继的ap1-2-3密码什么的在哪里设置

点评

scp登陆,然后把正在用的wireless文件另存为AP1 2 3 4,搜索下一个然后再保存  详情 回复 发表于 2016-5-1 22:04
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-5-1 22:04 | 显示全部楼层
kover 发表于 2016-4-29 20:16
那些中继的ap1-2-3密码什么的在哪里设置

scp登陆,然后把正在用的wireless文件另存为AP1 2 3 4,搜索下一个然后再保存

点评

mv /etc/config/wireless /etc/autoap/1 ? or mv /etc/config/wireless /etc/autoap/ap1 ? thanks  详情 回复 发表于 2016-5-11 10:06
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-5-10 11:18 来自手机 | 显示全部楼层
可以将关键代码注释一下吗?谢谢

点评

哪句不懂?有个AP的文件来标记当前使用的信号,然后检测互联网状态,如果断网就切换下一个,然后来回循环啊  详情 回复 发表于 2016-5-11 08:37
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-5-11 08:37 | 显示全部楼层
gelongrt 发表于 2016-5-10 11:18
可以将关键代码注释一下吗?谢谢

哪句不懂?有个AP的文件来标记当前使用的信号,然后检测互联网状态,如果断网就切换下一个,然后来回循环啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-5-11 09:17 | 显示全部楼层
  可惜了,我看不懂代码,不会用。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-5-11 10:06 | 显示全部楼层
晚点末班车 发表于 2016-5-1 22:04
scp登陆,然后把正在用的wireless文件另存为AP1 2 3 4,搜索下一个然后再保存

mv /etc/config/wireless /etc/autoap/1 ?
or mv /etc/config/wireless /etc/autoap/ap1 ?
thanks

点评

mv /etc/config/wireless /etc/autoap/ap1 这样,而且 大小写 AP1 not ap1  详情 回复 发表于 2016-5-11 20:40
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-5-11 10:17 | 显示全部楼层
切换时,是否需要延时?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-5-11 20:40 | 显示全部楼层
gelongrt 发表于 2016-5-11 10:06
mv /etc/config/wireless /etc/autoap/1 ?
or mv /etc/config/wireless /etc/autoap/ap1 ?
thanks

mv /etc/config/wireless /etc/autoap/ap1
这样,而且 大小写 AP1 not ap1
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-5-11 22:24 | 显示全部楼层
感谢分享~~~楼主写个luci出来呗

点评

用不着luci,论坛里有现成的,喜欢luci就用那个好了  详情 回复 发表于 2016-5-12 19:28
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2016-5-12 19:28 | 显示全部楼层
失、语 发表于 2016-5-11 22:24
感谢分享~~~楼主写个luci出来呗

用不着luci,论坛里有现成的,喜欢luci就用那个好了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2016-5-12 19:31 | 显示全部楼层
不错哦!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-3-29 01:11

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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

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