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

Filter by
Sorted by
Tagged with
53
votes
7answers
14k views

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 ...
48
votes
1answer
22k views

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.
35
votes
5answers
106k views

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 ...
13
votes
3answers
31k views

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 ...
3
votes
1answer
4k views

Systemd timeout because it doesn't detect daemon forking

I'm currently developping a systemd daemon. The problem I'm facing is that the daemon is killed 1m30s after beeing launched because the forking is not detected. I'm using the int daemon(int nochdir, ...
262
votes
5answers
428k views

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 ...
12
votes
3answers
23k views

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 ...
5
votes
2answers
6k views

Automatically kill process if its runtime exceeds some predetermined value

I want to start a process from a shell script, allow it to interact with the user (so I cannot just background it, grab the PID, launch sleep followed by sanity checks and kill), but if it is still ...
5
votes
1answer
11k views

Can the hard drive timeout be disabled in Linux (attempting task abort)

Unfortunately, when a hard drive (usually a virtual drive) is slow, Linux aborts requests to that drive after a timeout, possibly causing data corruption. Last time this happened to me, I had 2 vms ...
9
votes
5answers
22k views

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) ...
9
votes
2answers
21k views

named does't start when using systemctl

I am having trouble getting named to start using systemd on the Fedora 18 Raspberry Pi spin. It starts, then a few moments later there is a timeout and it fails. If I run the commands in named.service ...
5
votes
9answers
1k views

How to timeout by hours in Bash (and keep timing out even if the session was closed)?

I created the following script to install and then uninstall PHPmyadmin on Ubuntu 16.04... My aim is to use this script each time I want to use PHPmyadmin, and then, after some time like 2 hours, ...
1
vote
1answer
164 views

Making “at” or “sleep” utilities to print stdout in timeout, on the highest of Bash sessions [closed]

I want to execute a set of commands 2 hours ahead from current time (i.e, in a timeout). I need to keep using Bash regularly while these commands are timed-out (i.e, the commands need to run in ...
13
votes
2answers
19k views

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 ...
16
votes
1answer
1k views

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! ...
14
votes
4answers
33k views

How to change 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/...
6
votes
1answer
2k views

How to mount a Truecrypt container with a timeout from the command line?

I'm mounting a truecrypt container via the command line (i.e. truecrypt file dir). Is there any way to have truecrypt automatically unmount the container after a given amount of inactivity in dir?
1
vote
2answers
964 views

How to execute nohup in an heredocument?

I have this timeout code block: #!/bin/bash WB=$1 sleep 2h; commands... kill $WB To run the script with nohup and in the background, I can paste it in a file, and execute: nohup /opt/myscript.sh $$...
9
votes
2answers
8k views

change tty login timeout - ArchLinux

By default when I login to my Arch linux box in a tty, there is a timeout after I type my username but before I type my password. So it goes like this Login: mylogin <enter> Password: (+ 60 ...
3
votes
1answer
950 views

Send random data over TCP for a while, and count how many bytes were sent

To test data throughput, I want to 1) for X seconds 2) send random data 3) over TCP, and 4) to know afterwards exactly how many bytes were transmitted. My best attempt (which is not much) 1) timeout ...
2
votes
1answer
2k views

Slow boot time after cloning disk and resizing partitions

I recently replaced an SSD with a larger SSD. I used Clonezilla to clone the old disk to the new one. After that I used GParted Live to resize the existing partition, pushing the swap partition to the ...
2
votes
2answers
4k views

Apache SSL timeout is not matching settings

I have a CentOS 6.7 apache Server version: Apache/2.4.7 (Unix) server with both http and https ports configured. They are configured the same, except for the SSL specific settings. The most relevant ...
0
votes
1answer
498 views

use timeout and run ping in background and save the statistics to file

I'm writing a script to automatically do the ping test. because I have hundreds of endpoint to ping each other, and I don't want the script stop running because the ping stuck, so I use timeout, and ...