Created
August 5, 2025 03:12
-
-
Save Nexarian/bbbd91d893109d73b21617d1b7b6f004 to your computer and use it in GitHub Desktop.
Wait for lans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Maximum wait time in seconds | |
timeout=300 | |
elapsed=0 | |
while [[ $elapsed -lt $timeout ]]; do | |
up0=$(cat /sys/class/net/wlan0/operstate 2>/dev/null) | |
up1=$(cat /sys/class/net/wlan1/operstate 2>/dev/null) | |
if [[ "$up0" == "up" && "$up1" == "up" ]]; then | |
echo "[wait-for-wlans] wlan0 and wlan1 are up" | |
exit 0 | |
fi | |
echo "[wait-for-wlans] Waiting for wlan0/wlan1..." | |
sleep 2 | |
elapsed=$((elapsed + 2)) | |
done | |
echo "[wait-for-wlans] Timeout waiting for wlan0 and wlan1" | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment