Can Indigo power cycle my Airport / DSL Modem / Router?

Posted on
Sun Jan 18, 2009 11:35 am
gadgetnut offline
User avatar
Posts: 137
Joined: Nov 03, 2005
Location: San Juan Islands

(No subject)

Bill, thank you very much for responding. Your input is exactly what I needed. I found lots of choices under "remote power switch." What I'm deciding now is whether to hand over all the network maintenance duties to a full-featured remote switch like this

http://www.remotepowerswitch.com/remotepowerswitch.html

or continue to allow Indigo (and the above script) to monitor the modem and routers and just get a simpler, telephone-line based reboot switch for rebooting the computer:

http://www.remotepowerswitch.com/rps-home.html

For some reason, dalenis' script is causing frequent modem rebooting on my network (several times an hour) and I've disabled it... something is going on that is interfering with that ping... yet for all my internet needs, other than a hang once in awhile, I'm not otherwise aware of a problem.

Posted on
Sun Jan 18, 2009 12:54 pm
BillC offline
Posts: 237
Joined: Mar 09, 2008

(No subject)

I'm not familiar with the items you linked but the general concept is what I was talking about.

Here is another device that you might look at. I haven't used it either but xytronix (parent company) has a good reputation.

No telephone input but will do pings and reboot if no response (programmable criteria for number of pings, number of errors, etc). You could set one outlet up to try to ping your server's internal IP address and reboot the server if no response. The other devices (router and cable modem) could be controlled by the second outlet with pings going to a dependable outside IP address.

The switch would be placed on your internal network (behind the router).

Logic: if no ping response from server, it's locked up...power cycle.
If no ping from "the cloud", either the cable modem or router are down (or the cable service itself is down, no way to distinguish) so reboot both modem and router.

I see one possible issue with this and that's that sometimes the boot sequence matters. If the router boots before the modem, and is set up for DHCP (external), it can't get an IP address from the modem if it isn't up first. If that's the case (try booting them at the same time and see if it works or not) you might want to go with manual control via the phone line so you can boot first the modem, then the router, then the server. Won't be self-healing, though.

Posted on
Thu Jan 22, 2009 12:05 pm
gadgetnut offline
User avatar
Posts: 137
Joined: Nov 03, 2005
Location: San Juan Islands

(No subject)

I wanted to reverse myself. I bought the above referenced Remote Power Switch and had absolutely no luck administering it with the Macintosh web browsers-- their support urged me to try latest FireFox in Windows-- that's not going to work for me so I returned it. I have two WebSwitches from controlbyweb.com coming-- I spoke with them first on the phone today, they sound very knowledgeable and Mac-friendly-- and I'll post back very briefly here with my success with them. Once again, thank you for helping me along, Bill.

Posted on
Thu Jun 25, 2009 5:30 am
kenjon offline
Posts: 96
Joined: Dec 04, 2005
Location: Sweden

(No subject)

bianca wrote:
How can convert a broadband surfboard modem which is wired to wireless to wireless router? I have a Playstation3 so i need wireless BECAUSE THE MODEM IS TO FAR . How can i make a wired broadband network that runs on cable to wireless can i do this.Can connect the modem to a wireless router and it will work please help


I guess you're in the wrong forum, this is for questions regarding the Indigo software and connected devices. So you should try a forum that discusses the Playstation.
I use a D-Link DWL-G810, that works the way you described.

Posted on
Thu Nov 15, 2012 6:22 pm
thomasw offline
Posts: 135
Joined: Feb 13, 2011

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Hi Guys,
I just came across your discussion. I am an Indigo user, and had this same problem. I have DSL, and the connection sometimes goes down. The solution I found was to purchase an "Auto Ring Rebooter Plus". This device looks like a 6 plug power strip, and it connects to your phone line. You call into your house phone number that it's plugged into, and you can press prompts to turn the power off, power on, or power reset. You just keep your modem or router plugged into this device, and you can call in by phone, and turn it on/off/reset it. This really works well. The only thing is, you have to have a regular phone line in your house. I just put in a splitter from my desk phone jack, and I was good to go.
If anyone is interested, let me know and I'll pull out the name and address of the company I ordered it from.
-Tom

Posted on
Thu Nov 15, 2012 9:47 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Please post!

Posted on
Fri Jun 14, 2013 11:44 am
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Hello All,

Just came across this thread with much delight. Thank you dalenis for providing the script.
I am having an issue compiling the code.
Code: Select all
property this_URL : "www.apple.com"

--This script is based on a shell script from Apple's website called Qwik Ping
try
   set this_result to do shell script ("/sbin/ping -c 1 " & this_URL) as string
   if this_result does not contain "0%" then
--The above line checks for package loss if there is reset modem

      turn off "Modem"
      delay 3
      turn on "Modem"
      log "Connection failure!"
   end if

--If error is returned also reset modem

on error error_message
   turn off "Modem"
   delay 3
   turn on "Modem"
   log "Connection failure!"
end try


When I get to the first "turn off" there is a popup message saying:
Syntax Error, expected end of line,etc. but found identifier

Any tips on how to get this script working on OS 10.5.8 running Indigo Pro 4.X

T.I.A.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Fri Jun 14, 2013 12:47 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

If you're running it as an external AppleScript, you'll need to put the "turn on", "turn off" and "log" verbs inside a "tell application" block. Example:
Code: Select all
tell application "IndigoServer"
      turn off "Modem"
      delay 3
      turn on "Modem"
      log "Connection failure!"
end tell

Posted on
Fri Jun 14, 2013 12:52 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

nsheldon, once again you made the light bulb turn on!
Thank you again my friend for your help and support :)

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Sun Jun 16, 2013 5:34 am
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Hello again Everyone,

After two days of having this script in place I have noticed my modem resetting much more than what would be normal.

Does this script wait for a single ping?
Would it be possible to have the script respond after a defined number of pings to prevent premature modem resets?

I am still learning to applescript so any step-by-step help would be much appreciated.

T.I.A.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jun 17, 2013 1:43 am
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Having the script respond after a set number of failures would be possible. If you're going to go that rout, you'd probably want to increase the number of pings used for the test (change the number that comes after the "-c" flag in the shell script from 1 to something like 10). You could then modify the AppleScript to extract the percentage of packet loss and turn off/on the modem based on an acceptable percentage of packet loss (though there really shouldn't be any unless something odd is going on with your network, or the Apple web server you're using for your test).

To modify the AppleScript, it'd probably need to look something like this (untested, btw).
Code: Select all
set this_result to do shell script ("/sbin/ping -c 10 " & this_URL) as string
-- Strip everything before the packet loss percentage.
set AppleScript's text item delimiters to "received, "
set this_result to text item 2 of this_result
-- Now strip everything after the packet loss percentage (including the percent sign).
set AppleScript's text item delimiters to "%"
set this_result to text item 1 of this_result
-- Return the text delimiters back to default.
set AppleScript's text item delimiters to {""}
-- Convert the remaining result string to a number.
set this_result to (this_result) as number
-- Test the result. If it's over 20% packet loss, power-cycle the modem.
if this_result > 20 then
   tell application "IndigoServer"
      turn off "Modem"
      delay 3
      turn on "Modem"
      log "Connection failure!"
   end tell
end if

Posted on
Mon Jun 17, 2013 12:23 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Hello again nsheldon,

Thanks for the second response!
After inputting your recent script into Indigo log showed Timer loop time out occurred.
I played with the script but kept getting the same error. I was able to convert your applescript for guru into an applescript for toddlers

Code: Select all
try
    set thePing to do shell script "/sbin/ping -o -c 10 www.apple.com"
on error
    delay 30
    try
        set thePing to do shell script "/sbin/ping -o -c 10 www.apple.com"
    on error
        turn off "modem"
        delay 30
        turn on "modem"
        log "Connection failure!"
    end try
end try


Thank you again friend for taking the time to help and share your knowledge:)

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Mon Jun 17, 2013 12:26 pm
nsheldon offline
Posts: 2469
Joined: Aug 09, 2010
Location: CA

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

So did your updated version work?

Posted on
Mon Jun 17, 2013 12:31 pm
T-Power offline
User avatar
Posts: 220
Joined: May 10, 2010

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

Yes, it seems to be working.
Would like to see your script in action with all the masterful details.
Must learn to do the applescript walk before engaging in the applescript dance.

MacMini 2.3 GHz Intel Core i7 16GB DDR3
Indigo Pro 2022.1 macOS Mojave 10.14.6

Posted on
Tue Jul 22, 2014 9:57 am
spiv offline
Posts: 190
Joined: Jul 15, 2014

Re: Can Indigo power cycle my Airport / DSL Modem / Router?

On a related issue, I would like to have "Send email" as an action when a WAN/Internet connection failure is detected. How does Indigo handle sending email when the Internet is down? Will it simply log a failure, or is there is any queuing/retry ability built-in.

If there isn't any queuing, is there a straightforward scripting solution? Perhaps have the script log the starting time of the failure to a variable, then continue polling and when the connection is stable again (up for at least xxx minutes), send an email with the saved starting time value along with the current time.

Who is online

Users browsing this forum: No registered users and 4 guests