execute script or command via HTTP / browser URL?

Discussion in 'Tomato Firmware' started by luckman212, Dec 8, 2008.

  1. luckman212

    luckman212 LI Guru Member

    I sometimes need to flush the DNS cache on my tomato router. I usually SSH into the router, type "service dnsmasq restart". But this is heavy steps and I would like to automate this somehow into a script, batch file, shortcut etc that I can run easily. I know this is insecure etc but I am not concerned about that at this moment.

    Is there a way to automate the execution of a command via a simple HTTP GET to a specific tomato page? or can this be created? I know this capability exists on DDWRT that's why I was asking.

    thanks guys
  2. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Such a page could be created, but there should be no need. Many (most?) SSH clients have the capability to run a command and exit once connected. This can easily be incorporated into a script.

    What SSH client do you use?
  3. samuarl

    samuarl Addicted to LI Member

    I would also like to know how a command can be run from a page on the router.

    Last night I made my first shell script :biggrin:. I'm fairly pleased with it at the moment. Basically it takes the output from ipt-parse and parses it to a page on the router. ipt-parse can output html itself but I wasn't happy with the formatting. I have setup a scheduled task to run the code every 5 mins to update the stats.

    The task looks like this:
    And the output is this:

    I would like to add a form with a couple of date pickers to allow me to specify the time period for the data I want, and then call the command again but with the correct time period parameters. Any ideas?
  4. asdfasdf

    asdfasdf Addicted to LI Member

    samuarl, could you please post the script you made for generating that page? :)
  5. karogyoker

    karogyoker Addicted to LI Member

    how the hell did you do that?
    I use Tomato Firmware v1.25.8515 .2RAF ND and i dont have ipt-parse
    Can you list all the active connections and their used bandwith too?
  6. mstombs

    mstombs Network Guru Member

    HyperWRT Thibor used to have a web page based run command which was useful

    @karogyoker Google is your friend - softcoder has a thread somewhere here, a blog elsewhere and a project site here
  7. samuarl

    samuarl Addicted to LI Member

    Sorry, I don't have the script to format the stats exactly like in my picture anymore.

    You can get pretty close though just using ipt-parse. Follow the steps in the wiki and you should be able to get the bandwidth data out to an html page. I used the type 2 sqlite configuration.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice