News:

On Tuesday September 6th the forum will be down for maintenance from 9:30 PM to 11:59 PM PDT

Main Menu

OBi110 scheduled reboot

Started by dialtone, July 11, 2011, 02:14:31 AM

Previous topic - Next topic

dialtone

Is it possible to schedule an OBi110 to reboot at a specific time?
For instance, I want it to reboot at 4am when I am not at my desk.

infin8loop

#1
If you have a windows machine always running on the network with the Obi you could run the attached script via Task Scheduler at the appropriate time.  You will first need to change the IP address and password in the script to those of your Obi.  The script simply posts the same page that clicking on the "Reboot" button does on the local Obi Admin pages.
"This has not only been fun, it's been a major expense." - Gallagher

JTravers

Quote from: infin8loop on July 15, 2011, 11:13:22 AM
If you have a windows machine always running on the network with the Obi you could run the attached script via Task Scheduler at the appropriate time.  You will first need to change the IP address and password in the script to those of your Obi.  The script simply posts the same page that clicking on the "Reboot" button does on the local Obi Admin pages.

Works perfectly.
I've found that I need to reboot my OBi110 every once in a while or I sometimes end up with one-way audio. This should fix the problem.

Thanks!

earthtoobi

if you use linux and have this module try this:

lwp-request -C admin:<password> -e -d http://192.168.x.x/rebootgetconfig.htm

infin8loop

Quote from: earthtoobi on August 05, 2011, 04:27:08 PM
if you use linux and have this module try this:

lwp-request -C admin:<password> -e -d http://192.168.x.x/rebootgetconfig.htm

I fired up Ubuntu in VirtualBox and tried the above command.  Works great.  I learned something.  Thanks.
The thought of writing a java or perl script for linux made my dinosaur mainframer brain hurt.  This cmd is much easier!     
"This has not only been fun, it's been a major expense." - Gallagher

earthtoobi

you can add it to cron tab to schedule it.
if you have webmin installed, it makes it much more easier to schedule cron jobs and in general manage your Ubuntu/Linux.

QBZappy

#6
infin8loop,

Hi,
My OBi is registered as an extension to a Grandstream GXE PBX. I've been trying to do something similar to what you are doing with the OBi with the PBX. I have figured out that I can telnet to the PBX and at terminal I can type reboot, and it reboots. I need to figure out how to automate this under the task scheduler, or use your approach which accomplishes the same thing.

Using firefox addon firebug, I have been able to figure out the following to get to the reboot page of the GXE. My programming skills are nil. Using your method, I can only take it this far. It doesn't reboot the PBX. There isn't much code, perhaps you can have a look at the VBS script and maybe you can spot why it didn't work. Thanks.

strURL = "http://192.16.240.3:8083/cgi-bin/ccgi?pageID=27"
''change xxx.xxx.xxx.xxx above to the local IP address of your GXE

strPassword = "12345"
''change GXEpassword above to the password of your local GXE page login

Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.open "POST", strURL, False, "admin", strPassword
objHTTP.send
Set objHTTP = Nothing
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

QBZappy

Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

QBZappy

Decided to use a Telnet Scripting Tool a.k.a TST10.exe. Easy to setup and run under task scheduler. (Google it if you need more info).

To download:
http://support.moonpoint.com/downloads/windows/network/Telnet/tst10.php
(Click on "More info" to get a complete set of instructions.)
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

infin8loop

#9
Quote from: QBZappy on August 05, 2011, 09:56:33 PM
There isn't much code, perhaps you can have a look at the VBS script and maybe you can spot why it didn't work. Thanks.

Sorry I didn't notice the question sooner.  I cut and pasted your script (which was basically my script with the strURL and strPassword changed) into a test.vbs.  I changed the strURL and strPassword back to my obi110 and ran the script and it worked.

If physically typing "http://192.16.240.3:8083/cgi-bin/ccgi?pageID=27" into a browser window reboots your device then it's probably the correct URL.  Otherwise, perhaps it's a slightly different URL that is POSTed when clicking a button on the page that causes a reboot.

Otherwise, perhaps the login id "admin" needs to be changed to the login id (if not "admin) of your device in the line:
          objHTTP.open "POST", strURL, False, "admin", strPassword

Or maybe you don't have Windows Scripting Host (WSH) installed.  Do you get a listing of options if you go to a command line prompt and type "cscript" (without quotes of course)?  I've never had to install it but perhaps I'm just lucky.  

WSH can be downloaded from:
Windows XP (and probably later versions of Windows?): http://www.microsoft.com/download/en/details.aspx?id=8247
Windows 2000: http://www.microsoft.com/download/en/details.aspx?id=20240

I pretty much have stuck with Windows XP because that's what the company I work for is still using for our desktops.
No reason I can think of why WSH wouldn't work for your device if given the correct strURL, strPassword, and login id and you have WSH installed.

If none of this works then you might try invoking your script
at a command line (and task scheduler):   cscript c:\complete-path-here\script-name.vbs    (c: or actual drive letter:)
and look for any errror messages.

Quote from: QBZappy on August 11, 2011, 11:42:53 AM
Decided to use a Telnet Scripting Tool a.k.a TST10.exe. Easy to setup and run under task scheduler. (Google it if you need more info).
I see you have developed a solution using a different scripting language.  Feel free to post the script as an attachment. I'm at a loss because you apparently figured out the correct parameters (URL, login id, and password) to pass using the other scripting language.
"This has not only been fun, it's been a major expense." - Gallagher

QBZappy

infin8loop,

Hi, thanks for your reply.

At this point it is academic as I have a working solution. However it would be interesting to learn how to accomplish using web browser as not all devices can be controlled using telnet. I can confirm having Windows Scripting Host (WSH) is installed.

Typing in the url does not reboot the PBX. With your script and this url "http://192.16.240.3:8083/cgi-bin/ccgi?pageID=27", I can take to the web page were I need to press the reboot button. I think there is HTTP command to do this step.

Quote from: infin8loop on August 11, 2011, 06:08:28 PM
Otherwise, perhaps it's a slightly different URL that is POSTed when clicking a button on the page that causes a reboot.

I think this is more than likely the case. Do you know how to press the button via script?

(See attached image)

Using telnet uses a different approach. It didn't require an url. In my case to telnet into the PBX only the IP address, password and script command to "reboot" + keyboard equivalent of pressing "enter" into the terminal window was sufficient to reboot the unit.
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

infin8loop

Hi QBZappy,

Ok, I follow you now.  The Shotgun School of Programming and Bartending is now in session.
My script doesn't press buttons, it POSTs a page. We need to find the page that's POSTed when you click the Submit button.  Put your mouse over the white area where the "Reboot" and "Reset to Default" radio buttons are located and right click, choose "View Page Source" (or if in a frame "This Frame" then "View Page Source").
Look for radio buttons in the source code, something like:
<input type="radio" name="somename" value="somevalue1" />Reboot
<input type="radio" name="somename" value="somevalue2" />Reset to Default
The name "somename" will be the same on both buttons since only the selected button value is sent.  Then look for the URL of the page that's sent for the Submit button.  It's probably in a FORM/ACTION statement.  If action="thatpage.htm" then the strURL for my script would be something like "http://youripaddress/thatpage.htm?somename=somevalue1".  If action already contains a ?x=y name/value pair then append the somename=somevalue1 onto it using &somename=somevalue1.   Just make sure you replace youripaddress, thatpage.htm, somename, and somevalue1 with the appropriate values.  And don't use "somevalue2" unless you want the thing reset to default!  Whatever strURL you come up with should work by just typing it into a browser window first, before trying to use it in the script.  Good Luck!  And send any cool weather south to Texas.



"This has not only been fun, it's been a major expense." - Gallagher

QBZappy

infin8loop,

Thanks. I learn something new everyday. I will try it tonight.

We have a cool and intermittent rainy day here today. I'll try to send some good weather vibes down your way.
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

guyinsb

Quote from: earthtoobi on August 05, 2011, 04:27:08 PM
if you use linux and have this module try this:

lwp-request -C admin:<password> -e -d http://192.168.x.x/rebootgetconfig.htm

Also works with Mac OSX 10.6.8 (and probably many other versions)

neilio

Thanks for this!

Does anyone have an idea of how long the OBI can go before needing to be rebooted? I've set mine to run at 5am every day, but was curious if the problem was so bad that more frequent rebooting is required.

RonR

Quote from: neilio on October 02, 2011, 07:48:35 PM
Does anyone have an idea of how long the OBI can go before needing to be rebooted?

A properly operating OBi should *NEVER* need to be rebooted.

tome

Quote from: guyinsb on September 29, 2011, 09:01:44 PM
Quote from: earthtoobi on August 05, 2011, 04:27:08 PM
if you use linux and have this module try this:

lwp-request -C admin:<password> -e -d http://192.168.x.x/rebootgetconfig.htm

Also works with Mac OSX 10.6.8 (and probably many other versions)

In Lion (10.7.1) I had to specify the method (POST) and hit ctrl D after issuing this, otherwise I was getting the error: lwp-request5: LWP-REQUEST5 is not an allowed method

This worked:
lwp-request -m POST -C admin:password -e -d http://192.168.X.X:WEBSRVRPORTNUM/rebootgetconfig.htm  ^D

WEBSRVRPORTNUM is required if you changed it from default in:
System Management -> Device Admin -> Web Server -> Port

Tom

neilio

Quote from: RonR on October 02, 2011, 08:00:06 PM
Quote from: neilio on October 02, 2011, 07:48:35 PM
Does anyone have an idea of how long the OBI can go before needing to be rebooted?

A properly operating OBi should *NEVER* need to be rebooted.

Right. It seems like there are a bunch of people with this problem, though, so I don't know if this is specific to the firmware or if it's a hardware defect. At any rate it really needs to be addressed.

QBZappy

If you really feel like you need to reboot the OBi, wouldn't it be easier to attach the power plug of the OBi to a timer? I've seen timers which can be scheduled daily/weekly. Simpler and you won't need a computer to be on.
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

SeaObi

I don't get all this stuff about rebooting on a schedule.  My Obi110 went for 2 months without a reboot and I use it for many calls and many hours a day without a problem.