Simple short term scheduled task to check internet

Posted on
Sat Aug 04, 2018 10:18 pm
MountainEars offline
Posts: 175
Joined: Oct 19, 2010
Location: Georgetown, CA

Simple short term scheduled task to check internet

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

Posted on
Sat Aug 04, 2018 10:20 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Simple short term scheduled task to check internet

There is already a plug-in that does this. Have you looked at it to see if it matches your needs?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sun Aug 05, 2018 9:00 am
MountainEars offline
Posts: 175
Joined: Oct 19, 2010
Location: Georgetown, CA

Re: Simple short term scheduled task to check internet

I did not see that one. And I looked, just not good enough! I’ll check that out

Posted on
Sun Aug 05, 2018 9:50 am
MountainEars offline
Posts: 175
Joined: Oct 19, 2010
Location: Georgetown, CA

Re: Simple short term scheduled task to check internet

Works great, thanks!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests