Simple short term scheduled task to check internet
Posted: Sat Aug 04, 2018 10:18 pm
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
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