LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-11-2010, 02:02 PM   #1
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Rep: Reputation: 31
lynx as a background process


I'm writing a script which will simulate multiple users connecting to my webserver (and remaining connected, hence the use of lynx and not curl). I can specify a number of hits but lynx flags up as a foreground process which I then need to exit out of for the next 'hit' to get processed. I guess what I need is for lynx to connect to a page, then get sent to the background and then another lynx 'hit' is formed. Code below:

Code:
URL=www.myserver.com
echo -n "specify number of hits: "
read TIMES

function hitit {
for i in $(seq 1 $TIMES); do
        {
        lynx -accept_all_cookies "$URL" > /dev/null 2>/dev/null &

};
done
}
hitit
I'm a little new to the background process concep, perhaps someone could help

Last edited by genderbender; 09-11-2010 at 02:04 PM. Reason: lynx background
 
Old 09-12-2010, 06:22 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by genderbender View Post
I'm writing a script which will simulate multiple users connecting to my webserver
Aren't there tools for doing that?.........


Quote:
Originally Posted by genderbender View Post
I can specify a number of hits but lynx flags up as a foreground process which I then need to exit out of for the next 'hit' to get processed.
If you don't care about interactively controlling the process later on then at the time when you've backgrounded a suitable amount of processes you could say 'disown -a' them? Kill them later on with 'pkill -9 lynx'.
 
Old 09-12-2010, 08:37 PM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by genderbender View Post
(and remaining connected, hence the use of lynx and not curl).
curl keeps connection alive by default.
 
  


Reply



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
How to find the process ID of process executing in the background akeneche Linux - Newbie 1 01-03-2008 10:08 AM
background process ust Linux - General 1 12-15-2005 11:35 PM
really background a process Henster Linux - Newbie 1 07-01-2005 05:29 AM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM
Background Process mojozoox Linux - General 1 08-26-2003 02:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:11 PM.

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