Skip to content

Instantly share code, notes, and snippets.

@manio
Created March 3, 2025 12:11
Show Gist options
  • Save manio/028c5ebc1e791430743b29f0a25021b5 to your computer and use it in GitHub Desktop.
Save manio/028c5ebc1e791430743b29f0a25021b5 to your computer and use it in GitHub Desktop.
sample script which is stopping/starting aawgd based on nearby WiFi network visibility
#!/bin/sh
# this is a sample script which is testing if there is available ESSID on the WiFi
# and according to the result it is starting/stopping aawgd
# more info: https://github.com/nisargjhaveri/WirelessAndroidAutoDongle/issues/212#issuecomment-2692423007
delaytime=5
essid="searchedAPName"
while [ true ]; do
wifiavail='iw dev wlan0 scan|grep SSID'
if echo "$wifiavail" | grep -q "$essid"; then
/etc/init.d/S93aawgd stop
else
/etc/init.d/S93aawgd start
fi
sleep $delaytime;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment