Skip to content

Instantly share code, notes, and snippets.

@akira-kuriyama
Created June 25, 2021 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akira-kuriyama/78693798f0c7cdc8ae6719555ebcbc12 to your computer and use it in GitHub Desktop.
Save akira-kuriyama/78693798f0c7cdc8ae6719555ebcbc12 to your computer and use it in GitHub Desktop.
#!/bin/bash
WIFI_NAME=my-wifi-name
while true
do
if [[ -n `networksetup -getairportnetwork en0 | grep $WIFI_NAME` ]]; then
sleep 30
continue
fi
if [[ -n `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s | grep $WIFI_NAME` ]]; then
networksetup -setnetworkserviceenabled Wi-Fi off
networksetup -setnetworkserviceenabled Wi-Fi on
sleep 10
fi
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment