Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
macOS wifi auto disconnect & reconnect
#!/bin/bash
# 用法:在本地创建该文件
# 设置权限:`sudo chmod 755 ./wifi-auto-dis-reconnect.sh`
# 运行:`sudo ./wifi-auto-dis-reconnect.sh`
# 用完之后如果网络没恢复,需手动运行 `sudo networksetup -setnetworkserviceenabled Wi-Fi on`
echo "shit network testing tool by tom"
echo " "
while [ true ]
do
echo "Turning off WiFi…"
networksetup -setnetworkserviceenabled Wi-Fi off
echo "Done, sleep 15 sec"
sleep 15
echo "turning on WiFi…"
networksetup -setnetworkserviceenabled Wi-Fi on
echo "Done, sleep 15 sec"
sleep 15
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment