Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-14-2004, 12:21 AM   #1
LQ Newbie
Registered: Nov 2003
Location: Auburn University
Distribution: mandrake,gentoo
Posts: 10

Rep: Reputation: 0
Simple webserver test script (bash)

ok, I'm trying to do something simple and overcomplicating myself again...

I want to test an old pc of mine as a webserver. I'd like to:

open 5 concurrent connections to

wait 5 seconds

close connections


I've tried a few runs at it using w3m as my command line browser (which is probably the wrong thing to do) and had no success with the closing of the browser using $TIMEOUT or kill $!

any help would be greatly appreciated!

thanks in advance,

Old 01-14-2004, 02:03 AM   #2
Registered: Oct 2003
Location: Switzerland (Europe)
Distribution: OpenSuSE, RedHat, Knoppix, IRIX + MacOSX
Posts: 198

Rep: Reputation: 31
Well, 5 seconds are maybe a little to fast to establish all those connections, and your server could be limited to 4 sessions from the same computer.

This line works for me with the lynx Textbrowser:
lynx -accept_all_cookies -dump > dumpfile.txt
Now you can parse the file for "Error", "404" etc.

There a a few more parameters for lynx, like source, auth.

Very intresting could it be, to measure the time it takes to get the page.

Old 01-14-2004, 02:26 AM   #3
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
Hi. I don't know if it's what you're looking for, but the following will kill all instances of a program - you could launch 5 instances of (for example # lynx, wait 5 seconds, and kill them all with:

# ps -A | grep lynx | awk '{print $1}' | xargs kill -9

5 seconds later.

while true; do
lynx &
lynx &
lynx &
lynx &
lynx &
sleep 5
ps -A | grep lynx | awk '{print $1}' | xargs kill -9

It'll mess up your console while it's running, but it works.

Or you could use 'wget' to request whatever resources you want - wget returns to the console after it's finished downloading, so you wouldn't have to kill the processes.


Last edited by ilikejam; 01-14-2004 at 02:43 AM.
Old 01-14-2004, 10:30 AM   #4
LQ Newbie
Registered: Nov 2003
Location: Auburn University
Distribution: mandrake,gentoo
Posts: 10

Original Poster
Rep: Reputation: 0
hmm, interesting indeed. it looks like some of the things i've tried with slight variations..

thanks very mutch!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script 'test' question linmix Programming 5 11-29-2005 11:49 AM
Bash Script test for empty dir uopjohnson Linux - Software 3 10-07-2005 06:45 PM
Help with simple bash script - please tw001_tw Linux - Software 5 12-19-2004 09:02 PM
bash script test file operators... bulliver Programming 3 10-17-2003 12:06 PM
benchmark test bash script PTBmilo Programming 3 02-14-2003 04:37 PM

All times are GMT -5. The time now is 04:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration