LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Some Way to Execute a CGI Command Automatically (http://www.linuxquestions.org/questions/programming-9/some-way-to-execute-a-cgi-command-automatically-594898/)

des_a 10-26-2007 06:07 PM

Some Way to Execute a CGI Command Automatically
 
I've got a Buffalo WLI-TX4-G54HP. I love it, because it is a good way to allow myself to connect to the Internet. The only problem is that sometimes it disconnects and the easiest way to restore it is to reboot it.

It does so less when we connect it to the WRT300N router as opposed to the NETGEAR WGR614. However, a every once in a while it still does so.

I'm looking for a way to automate this procedure somehow. The desired target would be using a script for Linux. I can directly tell it via http:// to reboot with this URL: http://1.1.1.3/advance/apply.cgi?action=Reboot

This can be done using a browser, such as firefox or konqueror, or that one netscape like browser.

I'd like to automate the thing using a shell script. It should connect, using a command line browser of some sort, or a direct way to run the URL somehow. I'm not sure how to do this.

Second, even linking there requires a user name and password. I'll not give it away, however, I'd like it to enter them somehow by itself, as if it was me. How do I do this?

Tinkster 10-26-2007 06:18 PM

If the device uses cookies, and you're asked to authenticate,
you should be able to drive it with lynx and/or wget ...

I don't have a set-up similar to yours, so can't give you a
ready to use script. But I've done automation with both
tools for other purposes - e.g. to check whether a specific
web-service is still up and running ...



Cheers,
Tink

des_a 10-27-2007 05:16 PM

Thanks. Knowing which programs I might be able to use helps a lot. I don't know if it uses cookies or not. What I do know, is only that it does ask for a username or password, and somehow it "knows" whether I've entered it while the current window is opened or not. Somehow it works that way. However, I wouldn't want to keep a window opened all the time, so I need to automate it based off of something else. This should tell me what to look into next. Thanks!

Tinkster 10-27-2007 06:18 PM

Cool. Should you run into questions on either of those that you
can't resolve reading their man-pages come back and give's a holler ;}



Cheers,
Tink


All times are GMT -5. The time now is 02:30 AM.