Code Comments
Programming Forum and web based access to our favorite programming groups.Hi All, I want to execute a shell script which returns the response time from a URL (using wget(?)). Can this be done through a shell script and how? The OS in linux. Thanks in advance, ZM
Post Follow-up to this messageOn 4/2/2008 9:24 AM, Zinger wrote: > Hi All, > > I want to execute a shell script which returns the response time from > a URL (using wget(?)). Can this be done through a shell script and > how? The OS in linux. "time" may be all you need: $ time curl http://www.gnu.org/index.html >/dev/null 2>&1 real 0m0.304s user 0m0.030s sys 0m0.077s Depends what you're really looking for... Regards, Ed.
Post Follow-up to this messageZinger wrote: > Hi All, > > I want to execute a shell script which returns the response time from > a URL (using wget(?)). Can this be done through a shell script and > how? The OS in linux. Don't know what you mean by "response time", however try this: $ time wget your://url.here -- All the commands are tested with bash and GNU tools, so they may use nonstandard features. I try to mention when something is nonstandard (if I'm aware of that), but I may miss something. Corrections are welcome.
Post Follow-up to this messageOn 2008-04-02, Zinger <zmasood@gmail.com> wrote: > Hi All, > > I want to execute a shell script which returns the response time from > a URL (using wget(?)). Can this be done through a shell script and > how? The OS in linux. > > > Thanks in advance, > > ZM > time wget http://example.com/website -- Christopher Mattern NOTICE Thank you for noticing this new notice Your noticing it has been noted And will be reported to the authorities
Post Follow-up to this messageOn Apr 2, 11:43 am, Chris Mattern <sys...@sumire.gwu.edu> wrote: > On 2008-04-02, Zinger <zmas...@gmail.com> wrote:> Hi All, > > > > > time wgethttp://example.com/website > > -- > Christopher Mattern > > NOTICE > Thank you for noticing this new notice > Your noticing it has been noted > And will be reported to the authorities Hi, Thanks. As I mentioned, I am interested in how quickly the page I am trying to get opens up. So would "time" get me the response time from the URL? e.g. how long did the cnn.com page took to say open up (just as in it would have opened through a browser) in the example below? If yes then what is the value of response time? Is it 0.411seconds? ================== time wget cnn.com --12:07:27-- http://cnn.com/ => `index.html' Resolving cnn.com... 64.236.16.20, 64.236.16.52, 64.236.24.12, ... Connecting to cnn.com[64.236.16.20]:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://www.cnn.com/ [following] --12:07:27-- http://www.cnn.com/ => `index.html' Resolving www.cnn.com... 64.236.24.12, 64.236.29.120, 64.236.91.21, ... Connecting to www.cnn.com[64.236.24.12]:80... connected. HTTP request sent, awaiting response... 200 OK Length: 91,412 [text/html] 100% [======================================= ==================================== =======================>] 91,412 495.93K/s 12:07:27 (494.95 KB/s) - `index.html' saved [91,412/91,412] real 0m0.411s user 0m0.003s sys 0m0.002s ==========================
Post Follow-up to this messageZinger wrote: > Hi, > > Thanks. As I mentioned, I am interested in how quickly the page I am > trying to get opens up. > So would "time" get me the response time from the URL? e.g. how long did > the cnn.com page took to say open up (just as in it would have opened > through a browser) in the example below? So it seems you want to know the time it takes to see the page completely loaded in your browser (thus including objects referenced by that page). Note that his time may be different from the time needed to transfer all the objects across the network, since some objects (eg, java applets, flash movies) may need some time to initialize inside the browser, even when the page is already loaded. Also, there are other factors that affect the overall time, such as DNS lookups. That said, the -p option to wget may probably suit your needs. From the man page (which you should read anyway): -p --page-requisites This option causes Wget to download all the files that are necessary to properly display a given HTML page. This includes such things as inlined images, sounds, and referenced stylesheets. Read the man page, especially the full description for the -p option. You may want to use additional options, as indicated. > If yes then what is the value of response time? Is it 0.411seconds? >[cut] > real 0m0.411s > user 0m0.003s > sys 0m0.002s > ========================== man time. The elapsed time is the one listed as "real". -- All the commands are tested with bash and GNU tools, so they may use nonstandard features. I try to mention when something is nonstandard (if I'm aware of that), but I may miss something. Corrections are welcome.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.