[clug] A script to measure time to load a web page

Keith Goggin kgoggin at bigpond.com
Wed Mar 26 11:51:51 GMT 2008


Hi,

I need to record the time it takes to load a web page at different times of 
the day, for example hourly for 24 hours.

So far I have a script which spawns a browser and starts to load the web page. 
But I can't make it wait until the page is fully loaded before it returns to 
the calling script which reports the elapsed time.

I have no experience with bash scripting and may well be on the wrong track so 
any help would be much appreciated.


#!/bin/bash
START=$(date +%s)

./webpage.sh

END=$(date +%s)
DIFF=$(( $END - $START ))
echo “task completed in $DIFF seconds @ `date +%r%d%b%Y`”\ 
>> /lindata/Benchmark/result
exit


#!/usr/bin/expect
#The browser 'Links' loads a major web page and should not quit until an "OK" 
#has been received.
#Graphical mode & java-script is enabled. Caching is set to zero.

spawn /usr/bin/links -g -enable-javascript 1 -format-cache-size\ 
0 -memory-cache-size 0 -image-cache-size 0\
http://www.abc.net.au/news
expect "OK"
send "^C"
exit





More information about the linux mailing list