|
发表于 2021-7-17 17:15:46
来自手机
|
显示全部楼层
|阅读模式
来自 甘肃兰州
[pre]
while :
do
gateway=$(route -n | grep wlan0 | grep UG | awk '{print $2}')
if [ -z $gateway ];
then
echo "the gateway is null, wlan0 connecting..."
nmcli conn up MySSID
else
ping -c 3 -I wlan0 -s 8 $gateway >/dev/null 2>&1
if [ $? = 0 ];
then
echo "WiFi is connected"
else
echo "wlan0 connecting..."
nmcli conn up MySSID
fi
fi
sleep 150
done
[/pre] |
|