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
262
votes
5answers
430k 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 ...
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
107k 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 ...
21
votes
2answers
61k views

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 ...
20
votes
2answers
1k views

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 ...
16
votes
4answers
57k views

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 ...
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/...
14
votes
1answer
2k views

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

How long is a TCP local socket address that has been bound unavailable after closing?

On Linux (my live servers are on RHEL 5.5 - the LXR links below are to the kernel version in that), man 7 ip says: A TCP local socket address that has been bound is unavailable for some time after ...
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 ...
11
votes
6answers
31k views

How to avoid system timeout to login screen when I make a cup of tea?

Linux Mint 17.1 (MATE) running on HP G250 Laptop and older HP desktops. It's just me and the dog at home and I like to run the computer all day, but it keeps returning to the login screen after a few ...
11
votes
3answers
24k views

mptscsih: ioc0: task abort: SUCCESS (rv=2002) causes 30 seconds freezing

I/O to my software RAID6 often freezes for around 30 seconds after which everything is back to normal. After the freeze is over this is put into syslog: Mar 14 18:43:57 server kernel: [35649.816060] ...
10
votes
4answers
7k views

How to constraint time a program runs in Linux?

I have several simulations to do, each is invoked with python simulate.py <parameter list>. The problem with these simulations is that some of them hang without quiting, which prevents me from ...
10
votes
1answer
38k views

systemctl keeps timing out on service restart

I'm running CentOS 7.2; see below: # systemctl stop firewalld Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was ...
10
votes
1answer
2k views

Too big delay with xscreensaver on wrong password in OpenSUSE 12.2

There is too big delay when logging in with xscreensaver in OpenSUSE 12.2 --- Actual delay is 10 seconds, but not found anywhere in configs Already done: checked pam timeout in login.defs (3 ...
9
votes
3answers
22k views

Timeout function return value

I'm using the timeout function on debian to wait 5 seconds for my script. Works great but the problem I have is that I need a return value. Like 1 for timeout and 0 for no timeout How am I going to ...
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
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 ...
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 ...
9
votes
2answers
509 views

Kill a process if it goes quiet for a certain amount of time

I have a utility that has a nasty habit of going quiet and staying there, I already know how long into the process it does this so I am using timeout to fight this, but sometimes it does it before ...
8
votes
1answer
27k views

How do I remove the timeout in the boot menu

I installed several operating systems on my computer in a multiboot configuration (Ubuntu, Linux Mint, Windows, ...). When I turn on my PC, the boot menu appears with a timeout. Sometimes, I don't ...
7
votes
3answers
9k views

MySQL Linux Client Timeout/Keepalive

Is there a way to set a keepalive in the command-line MySQL client on Linux? Our network recently moved to a VLAN setup, and our systems department no longer has control of the firewall. The powers-...
7
votes
1answer
9k views

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

How to make gksudo or gksu sessions last longer in Linux

Every time I want to open a GUI program that needs root permissions, I have to put my password. For example, I open synaptic and put my password then close it and a second later decide to reopen it it ...
6
votes
3answers
1k views

How to send SIGKILLs to entire pipeline?

while true; do # process substitution instead of usual pipeline to avoid waiting for all programs handle_input_with_timeout < <( prog1 | prog2 | prog3 ) echo "Data stopped flowing. ...
6
votes
1answer
4k views

IPv6 connections timeout

I'm having issues with IPv6 connections. Only with those. They timeout roughly every 10 minutes (due to address renewal i suppose). Happens with every debian based flavour of linux i tried in a year ...
6
votes
1answer
607 views

Restart systemd service when output is no longer generated

Is it possible to restart a systemd service when there is no output generated for a predefined amount of time? I have a script which apparently can hang, but that is not detected by systemd (or ...
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?
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, ...
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
3answers
4k views

timeout without killing process in bash

I have a main script that I'm running, and from it I have a second "slow process" I want to kick off, and "do something" in the main script if it doesn't complete in the time limit -- depending on if ...
5
votes
1answer
825 views

Give script time to execute, if exceeded, stop it

Is this possible, to give max time in seconds to script for execution? for example, i have script, that pings some network. Usually, it takes about 10 seconds, but if execution takes more than 10 ...
5
votes
1answer
23k views

SSH connection timed out. it's not client or server…what now?

I have been using a Linux server via SSH for months, it still works from other locations but for some reason, this week, it isn't working from the office. Putty says "Connection timed out" Is there ...
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 ...
5
votes
2answers
54k views

How to find and edit “Apache timeout”?

I'm trying to view the default value of Apache timeout of my server, but I found nothing about that in /etc/httpd/conf/httpd.conf . So where is " timeout " supposed to be and how do I change its value ...
5
votes
3answers
7k views

SSH: connection reset after idle for some time

When my connection has been idle for some time, the remote host closes the connection. I try to type a new command, it hangs, then closes the connection. How can I keep the ssh connection active for ...
5
votes
1answer
2k views

Return status of Busybox `timeout` command

I'm writing a shell script that's supposed to function on various different distributions, some of which are using busybox and some are not. This script uses the timeout command to figure whether a ...
5
votes
3answers
816 views

Kill process when it stops to produce further output

Is there a shell tool which can probe if a subprocess is still producing output, and otherwise kill it after a specified timeout? I'm using offlineimap for Gmail backup, but that's very very very ...
5
votes
1answer
6k views

SSH to machines in new subnet - connection timeout

I'm using RHEL4 and RHEL5. A new group of Linux machines are setup recently using 172.16.32.0/24. The existing RHEL machines are running on 172.16.1.0/22 and 172.16.4.0/22. When I try to ssh from ...
4
votes
1answer
2k views

read timeout parameter (-t) not working?

I'm not sure how to explain the problem in general, so I'll just use this example: #!/bin/bash cleanup() { rm "$myfifo" rm "$mylock" kill '$(jobs -p)' } writer() { for i in $(seq 0 ...
4
votes
3answers
662 views

SSH-like session that survives physical network disconnection

I want my SSH login session to remain connected after the computer goes to sleep and wakes up. From what I understand TCP can survive intermittent network problems, so can I change settings so that it ...
4
votes
2answers
3k views

How to kill a command started over SSH - the SSH connection lost

If I use timeout 10 ssh -n -o BatchMode=yes 1.1.1.1 'sleep 20' > 1.1.1.1.txt 2>&1 & To give out a remote command on a server, and I kill the SSH connection after 10 seconds, then I can ...
4
votes
1answer
10k views

Where is TMOUT being set in CentOS 7? How can I disable it?

I know I've tracked this down before but can't find the answer. When I start a bash shell on CentOS 7 (from X Windows GNOME or KDE), the variable TMOUT is set which causes the shell to timeout after ...
4
votes
2answers
974 views

bash syntax - wrapping command inside sudo :: tail logs until string found with timeout using Terraform

Goal: using sudo execute a one line cmd to tail a log until a string is found and then exit 0. If the string is not found within a given timeout, exit anything but 0. Attempted Solution 1: ...
3
votes
2answers
3k views

Can we make ssh time out while waiting for a password

I have written a script that is expected to get a bunch of host names from some place and run a command on each of those hosts: ssh "$host" some command I have the necessary configuration to make ...
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, ...