Skip to content

Instantly share code, notes, and snippets.

@digiltd
Last active August 12, 2016 10:20
Show Gist options
  • Save digiltd/e8b2f2cc0476c122c151777150300f59 to your computer and use it in GitHub Desktop.
Save digiltd/e8b2f2cc0476c122c151777150300f59 to your computer and use it in GitHub Desktop.
Ping Google up to five times to test internet connectivity
# Source : http://stackoverflow.com/questions/13224718/check-for-active-internet-connection-with-applescript-automator
repeat with i from 1 to 5
try
do shell script "ping -o -t 5 www.google.com"
exit repeat
on error
delay 20
if i = 5 then error number -128
end try
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment