![当我的服务运行脚本时,会获取取消身份验证的本地选择(原因:3=DEAUTH_LEAVING),但我自己启动脚本时不会获取此信息](https://linux22.com/image/1003429/%E5%BD%93%E6%88%91%E7%9A%84%E6%9C%8D%E5%8A%A1%E8%BF%90%E8%A1%8C%E8%84%9A%E6%9C%AC%E6%97%B6%EF%BC%8C%E4%BC%9A%E8%8E%B7%E5%8F%96%E5%8F%96%E6%B6%88%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81%E7%9A%84%E6%9C%AC%E5%9C%B0%E9%80%89%E6%8B%A9%EF%BC%88%E5%8E%9F%E5%9B%A0%EF%BC%9A3%3DDEAUTH_LEAVING%EF%BC%89%EF%BC%8C%E4%BD%86%E6%88%91%E8%87%AA%E5%B7%B1%E5%90%AF%E5%8A%A8%E8%84%9A%E6%9C%AC%E6%97%B6%E4%B8%8D%E4%BC%9A%E8%8E%B7%E5%8F%96%E6%AD%A4%E4%BF%A1%E6%81%AF.png)
正如我的帖子标题所说,我有一个脚本(如下)运行到负责启动无线连接(WPA2)的服务中,如果不能,它会启动接入点模式。
#!/bin/bash
wget -q --tries=10 --timeout=20 --spider http://google.com
if [[ $? -eq 0 ]]; then
echo "Connected"
else
echo "Try to get a connection"
pkill wpa_supplicant
systemctl stop dnsmasq
systemctl stop hostapd
#systemctl disable dnsmasq
systemctl disable hostapd
ifdown wlan0
ifup wlan0=wlan_user
wget -q --tries=10 --timeout=20 --spider http://google.com
if [[ $? -eq 0 ]]; then
echo "Connected"
else
echo "Access point mode"
ifdown wlan0
systemctl restart dnsmasq
systemctl restart hostapd
ifconfig wlan0 up
ifconfig wlan0 10.0.0.1/24
#iptables -t nat -F
#iptables -F
#iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
#echo '1' > /proc/sys/net/ipv4/ip_forward
fi
fi
cp /etc/network/interfaces /tmp/interfaces
为了测试它是否有效,我在终端中启动它,它运行良好,但当它由我的服务启动时,它会连接但立即断开连接,并显示“获取取消身份验证的本地选择(原因:3 = DEAUTH_LEAVING)”。注意:它在连接到非 WPA 无线连接时有效