OBiTALK Community

General Support => Day-to-Day Use => Topic started by: dialtone on July 11, 2011, 02:14:31 AM

Title: OBi110 scheduled reboot
Post by: dialtone on July 11, 2011, 02:14:31 AM
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.
Title: Re: OBi110 scheduled reboot
Post by: 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.
Title: Re: OBi110 scheduled reboot
Post by: JTravers on August 05, 2011, 10:35:52 AM
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!
Title: Re: OBi110 scheduled reboot
Post by: 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
Title: Re: OBi110 scheduled reboot
Post by: infin8loop on August 05, 2011, 08:35:41 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

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!     
Title: Re: OBi110 scheduled reboot
Post by: earthtoobi on August 05, 2011, 09:23:28 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: QBZappy on August 05, 2011, 09:56:33 PM
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
Title: Re: OBi110 scheduled reboot
Post by: QBZappy on August 08, 2011, 02:07:39 PM
Bump,

Anybody
Title: Re: OBi110 scheduled reboot
Post by: 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).

To download:
http://support.moonpoint.com/downloads/windows/network/Telnet/tst10.php
(Click on "More info" to get a complete set of instructions.)
Title: Re: OBi110 scheduled reboot
Post by: infin8loop on August 11, 2011, 06:08:28 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: QBZappy on August 11, 2011, 07:53:05 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: infin8loop on August 12, 2011, 03:48:45 AM
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.



Title: Re: OBi110 scheduled reboot
Post by: QBZappy on August 12, 2011, 06:05:10 AM
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.
Title: Re: OBi110 scheduled reboot
Post by: 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)
Title: Re: OBi110 scheduled reboot
Post by: neilio on October 02, 2011, 07:48:35 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: 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.
Title: Re: OBi110 scheduled reboot
Post by: tome on October 02, 2011, 08:30:55 PM
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
Title: Re: OBi110 scheduled reboot
Post by: neilio on October 03, 2011, 05:07:07 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: QBZappy on October 03, 2011, 05:20:41 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: SeaObi on October 03, 2011, 06:57:17 PM
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.
Title: Re: OBi110 scheduled reboot
Post by: QBZappy on October 03, 2011, 07:57:01 PM
Same here. I never need to reboot.
Title: Re: OBi110 scheduled reboot
Post by: Ed1234 on November 11, 2011, 06:28:09 AM
Quote from: tome on October 02, 2011, 08:30:55 PM
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



Just a followup to this post - as it might be useful to someone else. I used a slightly different method in Lion.

In Lion I simply used:
lwp-request -m GET -C admin:password -e -d http://Obi100/rebootgetconfig.htm

You can replace "Obi100" with your actual IP address, but for me that resolves automatically.

Title: Re: OBi110 scheduled reboot
Post by: Ed1234 on November 11, 2011, 06:49:35 AM
Quote from: SeaObi on October 03, 2011, 06:57:17 PM
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.

Are you sure you don't have the same problem?  Most of the time it will be the person on the other end who is hearing the issues with your Obi - not you.  Unless the person on the other end makes a point of saying "Hey...your voice quality is bad" you probably won't know about it.  I realized I had a problem when my daughter called me at work on it....and she was breaking up quite a bit.  After rebooting...perfect quality again.  A friend of mine has a VOIP phone through his cable company and when talking to him it is very bad, but to him everything is perfect.






Title: Re: OBi110 scheduled reboot?
Post by: kirk on November 14, 2011, 09:01:29 AM
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.

This sounds awesome, is there a way to explain it in laymen's terms?  I am running win 7, can find the task scheduler, and know the IP of the obi110.. But have no idea what to do next... Thanks! : )
Title: Re: OBi110 scheduled reboot
Post by: dlee on March 19, 2012, 07:26:00 PM
Clarification: I want to reboot my Obi110 using cron on my tomato router

Can anyone help -- I want to schedule reboot on my tomato router.

I tried the command below, and provided the correct password and IP address:
curl -u admin:<password> "http://192.168.X.X/rebootgetconfig.htm"

But, I get this error message:
401 Unauthorized!

Can anyone help?
Title: Re: OBi110 scheduled reboot
Post by: dlee on March 19, 2012, 10:10:09 PM
Quote from: infin8loop on March 19, 2012, 08:51:11 PM
Quote from: dlee on March 19, 2012, 07:26:00 PM
Can anyone help -- I want to schedule reboot on my tomato router.

I tried the command below, and provided the correct password and IP address:
curl -u admin:<password> "http://192.168.X.X/rebootgetconfig.htm"

But, I get this error message:
401 Unauthorized!

Can anyone help?

As written I'm not sure if you are trying to reboot your router or your OBi.  If you are trying to reboot an OBi and the '192.168.X.X' part is the actual IP address of the OBi then 401 indicates whatever was supplied in place of <password> is not a valid password for the OBi.  If you are trying to reboot your router then the 'rebootgetconfig.htm' part isn't going to work since it's specific to an OBi. If it's the router you want to reboot then you will need go spelunking into the html source of your router config pages to figure out what URL triggers a reboot of the router (if there is one) and put that page in place of the 'rebootgetconfig.htm' part, and set the password and IP address to that of the router.  I don't run tomato (I run couch potato), so I cannot tell you.        

Update: And 'admin' may or may not be the proper user id to use on the router but it does work on an OBi.    

I want to reboot Obi110 using cron on my tomato router.
I updated my original post to clarify.
Title: Re: OBi110 scheduled reboot
Post by: infin8loop on March 19, 2012, 11:27:27 PM
Quote from: dlee on March 19, 2012, 07:26:00 PM
Clarification: I want to reboot my Obi110 using cron on my tomato router

Can anyone help -- I want to schedule reboot on my tomato router.

I tried the command below, and provided the correct password and IP address:
curl -u admin:<password> "http://192.168.X.X/rebootgetconfig.htm"

But, I get this error message:
401 Unauthorized!

Can anyone help?

I was able to install curl in Ubuntu running in a VirtualBox and to get the following to work:

curl -u admin:ppppppppp --anyauth http://192.168.x.x/rebootgetconfig.htm

Replacing the p's (password) and x's (ip) with appropriate values.  The key seems to be the addition of the --anyauth parameter which I found in a curl manual (luckily the first I tried!).  It seems to work equally well with or without the double quotes around the URL.      
Title: Re: OBi110 scheduled reboot
Post by: dlee on March 20, 2012, 09:22:04 AM
Quote from: infin8loop on March 19, 2012, 11:27:27 PM
Quote from: dlee on March 19, 2012, 07:26:00 PM
Clarification: I want to reboot my Obi110 using cron on my tomato router

Can anyone help -- I want to schedule reboot on my tomato router.

I tried the command below, and provided the correct password and IP address:
curl -u admin:<password> "http://192.168.X.X/rebootgetconfig.htm"

But, I get this error message:
401 Unauthorized!

Can anyone help?

I was able to install curl in Ubuntu running in a VirtualBox and to get the following to work:

curl -u admin:ppppppppp --anyauth http://192.168.x.x/rebootgetconfig.htm

Replacing the p's (password) and x's (ip) with appropriate values.  The key seems to be the addition of the --anyauth parameter which I found in a curl manual (luckily the first I tried!).  It seems to work equally well with or without the double quotes around the URL.      

Thank You - that worked, and for pointing me in the right direction.
I also tried "--digest" without "--anyauth", and "--digest" worked also.
Title: Re: OBi110 scheduled reboot
Post by: jentzd on August 22, 2017, 01:14:36 AM
thanks for the thread on this.

i was able to modify the command to get wget to work.

wget --user admin --password <password> http://192.168.xx.xx/rebootgetconfig.htm

Wget returned an auth error, but my phone/device still rebooted. Nice!! Now I can cron it.