如果局域网已连接?
我想编写一个脚本并将其放入 /etc/rc.local
中,以便
如果局域网已连接
rfkill block all
,
nmcli con up id 'Network id' --nowait
那么我应该如何编写 if
部分以及如何检查对于“局域网已连接”?
I want to write a script and put it in /etc/rc.local
so that
if lan is connected then
rfkill block all
else
nmcli con up id 'Network id' --nowait
How should I write the if
part and how should I check for "lan is connected" ?
您可以检查:如何检测网络电缆/连接器的物理连接状态?
我认为至少有一个答案应该适合你!
You can check : How to detect the physical connected state of a network cable/connector?
I think at least one of the answer should work for you !