Last active
March 24, 2020 08:53
-
-
Save m4rr/5c9ce7955eb3b3928c59f0d2f80e5219 to your computer and use it in GitHub Desktop.
restart macos wifi if there is no internet connection
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
repeat 30 times | |
(* run for 30 minutes every 1 minute *) | |
repeat 60 * 60 times | |
(* run for 60 minutes every 1 second *) | |
set status to do shell script "networksetup -getairportpower en0" | |
if status ends with "Off" then | |
do shell script "networksetup -setairportpower en0 on" | |
else | |
try | |
do shell script "ping -t1 -c1 1.1" | |
on error errmsg number errnr | |
if errnr > 0 then | |
if (do shell script "networksetup -getairportnetwork en0") ends with "Aquarium" then | |
do shell script "networksetup -setairportpower en0 off" | |
else | |
end if | |
exit repeat | |
end if | |
end try | |
end if | |
delay 1 | |
end repeat | |
delay 30 | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment