复制以下部分保存为dwkillwifi.sh,winscp上传到/bin,修改权限为0755,并在OPENWRT的开机启动项,添加如下:/bin/dwkillwifi.sh 脚本功能:断网关闭wifi,来网开启wifi。
祝好运!
#dwkillwifi.sh
#!/bin/sh /etc/rc.common
#Autho
#dwkillwifi.sh
#!/bin/sh /etc/rc.common
#Author:xiefengxiyu
dns11="202.114.0.131"
NETOKZHI=1
NETOKZHI_COPY=1
while true
do
ping -s 1 -c 1 $dns11
if [ "$?" = "0" ]
then
NETOKZHI="1"
else
NETOKZHI="0"
fi
if [ "$NETOKZHI" -gt "$NETOKZHI_COPY" ]
then
#echo "$NETOKZHI -gt $NETOKZHI_COPY: NETOKZHI is greater than NETOKZHI_COPY"
wifi up
sleep 5
fi
if [ "$NETOKZHI" -lt "$NETOKZHI_COPY" ]
then
#echo "$NETOKZHI -lt $NETOKZHI_COPY: NETOKZHI is less than NETOKZHI_COPY"
wifi down
sleep 5
fi
NETOKZHI_COPY=$NETOKZHI
sleep 5
done
转于,未测试https://wenku.baidu.com/view/9c46bd8d3b3567ec102d8ad8.html