Questions tagged [timeout]

A command which runs a specified command for a given time, and then terminates it. See http://man7.org/linux/man-pages/man1/timeout.1.html

204 questions
403
votes
5 answers

Does curl have a timeout?

So far I couldn't find anything really, but is it true that curl doesn't really time out at all? user@host:~# curl http://localhost/testdir/image.jpg I'm asking because I'm redirecting any request for images in testdir to a separate Apache module…
Preexo
  • 4,613
  • 4
  • 19
  • 21
61
votes
7 answers

Timing out in a shell script

I have a shell script that's reading from standard input. In rare circumstances, there will be no one ready to provide input, and the script must time out. In case of timeout, the script must execute some cleanup code. What's the best way to do…
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
60
votes
2 answers

Run a command for a specified time and then abort if time exceeds

I want know how I can run a command for a specified time say, one minute and if it doesn't complete execution then I should be able to stop it.
nikhil
  • 992
  • 2
  • 10
  • 16
45
votes
5 answers

How to introduce timeout for shell scripting?

I want to run a shell script that got a loop in it and it can go for ever which I do not want to happen. So I need to introduce a timeout for the whole script. How can I introduce a timeout for the whole shell script under SuSE?
Radek
  • 2,943
  • 18
  • 39
  • 52
30
votes
3 answers

How to execute code in a new tmux session - from within current session?

I use Ubuntu 16.04 and I need the following tmux solution because I want to run a timeout process with sleep as in my particular case I wasn't satisfied from at and encountered a bug with nohup (when combining nohup-sleep). Now, tmux seems as best…
user149572
25
votes
4 answers

What is the difference between ping -w and ping -W?

What is the -w (deadline) flag in ping for? I cannot find a description of it in the ping man page; only for -W, which takes seconds as a parameter. What is the difference between them, and how can I set a ping timeout (if host is not responding) to…
Rafael T
  • 815
  • 3
  • 11
  • 16
24
votes
4 answers

Set timeout for web page response with curl

I use a tool to monitor if the web-page is up and running. The tool uses curl command internally to fetch the output. However, when a web-page takes longer time to respond, it results back with a TIMEOUT error. There is no way that I can increase…
user80040
  • 351
  • 1
  • 3
  • 4
22
votes
1 answer

POSIX equivalent for GNU timeout?

The GNU coreutils timeout command is extremely handy for certain scripting situations, allowing for using the output of a command if it is quick to run, and skipping it if it would take too long. How can I approximate the basic behavior of timeout…
Wildcard
  • 35,316
  • 26
  • 130
  • 258
22
votes
6 answers

read only TMOUT variable – workaround to disable automatically exit shell when there is no activity

We have here a read only Bash variable. I am not allowed to unset that variable. $ echo $TMOUT 1800 As a workaround I wrote those lines (that my session don't exit) #!/usr/bin/perl $|++; while (1) { print "\e[0n"; sleep 120; } Is there an…
Sybil
  • 1,653
  • 5
  • 19
  • 37
22
votes
2 answers

How to make a TCP socket time out

For network catastrophe simulations of our server environment, we are looking for a way to intentionally timeout a TCP socket. Are there any simple ways for existing sockets? Also, little C test-case program would be a plus. We have already tried…
er453r
  • 867
  • 2
  • 8
  • 22
21
votes
3 answers

timeout, breaking pipes and wc

I had an idea to quickly benchmark some decompression programs. E.g. for gz, I would run the command: timeout 10 zcat foo.gz | wc -c Which would measure the amount of data the decompressor could extract in 10 seconds. The only problem is, that it…
P.Péter
  • 525
  • 3
  • 12
21
votes
4 answers

How to change network interface connection timeout in systemctl

When I boot my Debian system, its startup hangs for approximately 2 minutes on the line: Loading, please wait... [ 5.191043] systemd-fsck[129]: /dev/mmcblk0p2: clean, 234192/873120 files, 2335263/3491328 blocks [ 6.645242] intel_rapl: no valid…
Jealie
  • 312
  • 1
  • 2
  • 7
17
votes
1 answer

Why does oot say "hey" in usleep -o?

On a Centos 6.6 box I noticed this... [root@abcd /]# usleep --help Usage: usleep [microseconds] -v, --version Display the version of this program, and exit -o, --oot oot says hey! Help options: -?, --help Show this help…
nkthrasher
  • 171
  • 4
16
votes
3 answers

Bash if command doesn't finish in X time?

I'm trying to run something like: sudo dhclient $wifi || otherFunction Problem is when dhclient fails it just hangs instead of throwing an error. How can I re-write the above so dhclient is killed and otherFunction gets called if dhclient doesn't…
Philip Kirkbride
  • 9,816
  • 25
  • 95
  • 167
15
votes
1 answer

Is there a way for setting a shorter timeout in an ssh command?

I am writing a Bash script that performs several commands on remote machines via SSH. The problem is when one of those machines is unreachable, I would like the script to skip and move on instead, it stays stuck until and after a long time it gives…
kuma
  • 275
  • 1
  • 2
  • 5
1
2 3
13 14