Skip to content

Instantly share code, notes, and snippets.

@funatsufumiya
Created November 29, 2021 09:03
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 funatsufumiya/3f919d74f345480b1baabb7dd1773edb to your computer and use it in GitHub Desktop.
Save funatsufumiya/3f919d74f345480b1baabb7dd1773edb to your computer and use it in GitHub Desktop.
#!/bin/sh
while true
do
/sbin/ping -W 3 -t 1 google.com>/dev/null
if [ $? -ne 0 ]; then
date=$(date "+%Y/%m/%d %H:%M:%S")
echo "reconnecting... ($date)"
networksetup -setairportpower en0 off
networksetup -setairportpower en0 on
echo "done"
sleep 1
fi
#echo "OK"
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment