監控無線網路
ubuntu-mate@ubuntu-mate:~$ nmcli device wifi connect eduroam
裝置「wlp4s0」已成功以「2439cc43-4b15-4c4e-8102-d036ab80d430」啟用。
ubuntu-mate@ubuntu-mate:~$ nmcli device wifi connect TN-Teacher
裝置「wlp4s0」已成功以「77b6a030-977c-4aa5-b86f-9c0611eaf8ce」啟用。
#檢查dns
dig www.google.com | grep ^www.google.com | awk '{print $NF}'
fping 8.8.8.8
fping www.google.com
建立定期檢查shell程式
#!/bin/bash
for wifi in TN-Teacher eduroam
do
timeout 15 nmcli device wifi connect $wifi
if [ $? -eq 0 ]; then
echo "$wifi 連線成功"
if [ "`fping 8.8.8.8 | grep 'is alive'`" ]; then
echo "outside IP 連線 OK"
fi
if [ "`fping www.google.com | grep 'is alive'`" ]; then
echo "網際網路連線OK"
fi
fi
done
speedtest-cli
Retrieving speedtest.net configuration...
Testing from Taiwan Academic Network (120.116.6.111)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by CNS (Tainan) [3.18 km]: 10.262 ms
Testing download speed................................................................................
Download: 105.89 Mbit/s
Testing upload speed......................................................................................................
Upload: 104.60 Mbit/s
nmcli -f ACTIVE,SIGNAL dev wifi list | awk '$1=="是" {print $2}'
Last updated