Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
[脚本]每2分钟检测网络慢就重启wifi,临时解决wifi断流问题
Experiences and Insight
395
views ·
0
replies ·
To
floor
Go
177******61
deepin
2019-06-05 20:56
Author
最近几个月在公司电脑wifi总是断流, 是公司网络问题, 每次出现上不去网就需要重连wifi.已知公司个别Mac电脑也有这个网络问题.
无奈下写了这个脚本.每两分钟检测一下网络. 如果慢就重启下网卡. 算是临时解决了问题.
cat /home/k/bin/reConnectWifi.sh
#!/bin/bash
timeout 1 ping
https://bbs.deepin.org/module
-c 1 2>/dev/null 1>&2
if [ $? != 0 ]; then
nmcli radio wifi off && sleep 1 && nmcli radio wifi on
fi
然后在定时任务中加上这个脚本每两分钟执行一次:
crontab -e
1-58/2 * * * * /home/k/bin/reConnectWifi
写这个帖子的目的:
1是万一大家有谁碰到一样的问题.可以有个参考解决方案.
2是想说linux是很灵活的.碰到问题稍稍动手,就可以有很多解决方案.
Reply
Like 0
Favorite
View the author
All Replies
No replies yet
Please
sign
in first
Featured Collection
Change
Nuntia - Modern IMAP/SMTP mail client for Deepin (Beta tester wanted!)
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
External Soundcard (Steinberg UR44C) produces no sound via PipeWire
Taskbar no longer shows popups
Popular Events
More
最近几个月在公司电脑wifi总是断流, 是公司网络问题, 每次出现上不去网就需要重连wifi.已知公司个别Mac电脑也有这个网络问题.
无奈下写了这个脚本.每两分钟检测一下网络. 如果慢就重启下网卡. 算是临时解决了问题.
cat /home/k/bin/reConnectWifi.sh
#!/bin/bash
timeout 1 ping https://bbs.deepin.org/module -c 1 2>/dev/null 1>&2
if [ $? != 0 ]; then
nmcli radio wifi off && sleep 1 && nmcli radio wifi on
fi
然后在定时任务中加上这个脚本每两分钟执行一次:
crontab -e
1-58/2 * * * * /home/k/bin/reConnectWifi
写这个帖子的目的:
1是万一大家有谁碰到一样的问题.可以有个参考解决方案.
2是想说linux是很灵活的.碰到问题稍稍动手,就可以有很多解决方案.