Timing out lynx request in a bash script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Timing out lynx request in a bash script
# 1  
Old 05-20-2009
Timing out lynx request in a bash script

I have a Bash script where, in a loop, I access several urls.

Sometimes, if an url is not available, lynx hangs, and the script does not continue. How can I time out the lynx request when it takes more than, 10 Seconds, but continue with the other jobs...

For some reason lynx does not care if a -connect_timeout=10 is set...
# 2  
Old 05-21-2009
for those who care about a solution for this, you can build this inside you script:

typeset -i w=0
while ps $pid >/dev/null
do
sleep 1
w=$w+1
if [ $w -ge 10 ]
then
kill $pid
break
fi
done
This User Gave Thanks to lowmaster For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies

2. Shell Programming and Scripting

Request per second script

Hello; I'm having about 800 log files and i'm trying to write a script that report the counts of lines per second or "requests per second" in each log file and report the output which includes the timestamp for the highest lines per second count and the log file name and the highest number per... (5 Replies)
Discussion started by: Katkota
5 Replies

3. Shell Programming and Scripting

Timing the shell script

I have two shell scripts, one written with xargs for parallel processing (p1) and the other written in old school way (p3) . when I execute them, i get the below values. $ time ./p1 real 0m25.36s user 0m0.32s sys 0m0.80s $ time ./p3 real 0m23.25s user 0m6.20s sys ... (4 Replies)
Discussion started by: luhah
4 Replies

4. Shell Programming and Scripting

Timing a script

i have a very big script i have that i'd like to add a timeout to. this script runs on a several remote host. i update this script with timeout clause and then copy it over to all the hosts on which it is currently on. basically, i want the timeout to make the script abort/exit if it's... (1 Reply)
Discussion started by: SkySmart
1 Replies

5. Shell Programming and Scripting

bash: How to send the output to a file upon users' request?

Let's say I have a script which creates a report. I use getopts to have different options available to the user. One of these options is -f which basically exports the output of script to a text file which user may give the name of that text file. How can I output the result to the requested file.... (3 Replies)
Discussion started by: bashily
3 Replies

6. Shell Programming and Scripting

Challenging task : script for mailing process completion timing report to users.

Hi all, This is my first post. I am new to unix scripting. My requirement is as follows : We are using a financial backoffice application. Now at the end of day we have send users a status report stating all timings of EOD processes for all countries. I need timings for following... (0 Replies)
Discussion started by: ammbhhar
0 Replies

7. UNIX for Advanced & Expert Users

Using a request script

I am creating a package(Solaris10 on sparc) that needs user input. As I understand it, I need to use a request script. My problem is that the value I set in my request script is not visible in my postinstall script. Not sure if I am doing it right. Here is an example request script... (4 Replies)
Discussion started by: Tornado
4 Replies

8. Shell Programming and Scripting

Request for comments -- Directory favorites under bash

Here are a couple of files related to some ideas I have had on providing a mechanism for navigation across a set of "favorite directories." I would appreciate any comment on the approach and any other useful recommendations. Please visit my project home page on sourceforge Bash Navigator Home... (0 Replies)
Discussion started by: rlandon@usa.net
0 Replies

9. Shell Programming and Scripting

HTML display timing problem under ksh script

Using a HTML page , i'm running a Unix ksh script with <a href=..>. The script contains loop like this : for i in do rsh..... done each rsh command is running quite long and then i would display results in HTML format but about 5mn my blank page waiting for result is running in error... (1 Reply)
Discussion started by: Nicol
1 Replies
Login or Register to Ask a Question