Page 1 of 1

Simple short term scheduled task to check internet

PostPosted: Sat Aug 04, 2018 10:18 pm
by MountainEars
I'm not a script person....will say that up front ;-)

I'm having some internet issues, hopefully temporary. Just want to setup a scheduled task to run every few minutes to check for the internet, seems like that would be a simple way to go. I should be able to setup a scheduled task to run at some interval and kick off an applescript to ping Google DNS or something like that, if it fails, wait a few seconds and try again, if that fails, then turn off a device and then turn that device back on about 30 seconds later (the power to the antenna). I've seen some scripts that look like it should do something like that, but looking to find something I can just cut and paste into a scheduled job.

The ones I've seen that seem to be close are something like this but it doesn't seem to be quite right. Bonus would be to send a message via the Mail.app letting me know that it did the reset.

Ken


try
"/sbin/ping -o -c 10 www.apple.com"
on error
delay 30
try
"/sbin/ping -o -c 10 www.apple.com"
on error
turn off device "Modem"
delay 30
turn on device "Modem"
log "Connection failure!"
end try
end try

Re: Simple short term scheduled task to check internet

PostPosted: Sat Aug 04, 2018 10:20 pm
by Different Computers
There is already a plug-in that does this. Have you looked at it to see if it matches your needs?

Re: Simple short term scheduled task to check internet

PostPosted: Sun Aug 05, 2018 9:00 am
by MountainEars
I did not see that one. And I looked, just not good enough! I’ll check that out

Re: Simple short term scheduled task to check internet

PostPosted: Sun Aug 05, 2018 9:50 am
by MountainEars
Works great, thanks!