LinuxQuestions.org
Review your favorite Linux distribution.
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 10-07-2003, 08:25 AM   #1
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Rep: Reputation: 30
Running a browser long enough to load a page, then killing it.


I'd like to test the availability of a java page from a crontab script. I've an HTML page I can post, which I can check the response via command line ethereal to check the page is active.

To do this, I'm starting mozilla with the html page and checking for the correct response. My question is, how can I kill mozilla after the page has been served (say after 10 secs). Is there some way of assigning a variable the process ID of the instance of mozilla that I can kill again? Is there a better way to do this?

Dave...
 
Old 10-07-2003, 09:23 AM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
I'm not sure what you are doing, but it sounds like you need curl or wget instead of mozilla.

In general, to kill a program after it has run some time, you need
something like timeout
(as a non-debian user there is the link for the upstream sources -- or look for the packages in your own distribution; as a debian user, run apt-get install thepackageinquestion).

In bash, the process id of the program spawned into the background is stored into the variable !, and for an useless example of how to use the variable
Code:
sleep 30s & sleep 2s ; kill $!
spawns the first (30 sec long) sleep into the background (pid stored into $!), starts to sleep 2sec and kills the first sleep when the second sleep is ready.
 
  


Reply


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
10.1 official: long delay during name resolution by web browser marksouth2000 Mandriva 15 06-15-2006 11:08 AM
Killing running processes hitest SUSE / openSUSE 4 09-03-2005 02:22 PM
my web browser "mozilla fire fox" isn't rendering the page, rather opening the page amolgupta Linux - Software 2 07-26-2005 12:41 AM
Long pause during OO load mooreted Slackware 3 12-01-2004 08:33 AM
Why does OpenOffice take so long to load? mymojo Linux - Newbie 14 12-13-2003 03:55 PM

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

All times are GMT -5. The time now is 11:06 AM.

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