15 lines
428 B
Bash
Executable File
15 lines
428 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Start the ap0 service (access point) if wlan0 is active but not connected
|
|
|
|
# returns "active" or "inactive"
|
|
wlan_active=$(/usr/bin/systemctl is-active wpa_supplicant@wlan0.service)
|
|
|
|
# returns "up" or "down"
|
|
wlan_state=$(cat /sys/class/net/wlan0/operstate)
|
|
|
|
if [ $wlan_active = "active" ] && [ $wlan_state = "down" ]; then
|
|
echo "Starting ap0 service"
|
|
/usr/bin/systemctl start wpa_supplicant@ap0.service
|
|
fi
|