Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
1answer
25 views

Exported Date Variable not appearing in subshell

I'm currently working on creating 2 bashes with two different scripts which result in two files named with the same timestamp for easy comparison/processing later. The date variable gets created in ...
2
votes
1answer
37 views

Cat blocking when piping output from /usr/bin/gssproxy (`timeout -k 1 1 /usr/bin/gssproxy | cat` does not terminate)

I use gssproxy under Arch Linux, in particular Name : gssproxy Version : 0.8.0-1 I encountered the following behavior: When trying to pipe the output of /usr/bin/gssproxy like ...
2
votes
2answers
70 views

Setting variable output from timeout

I'm trying to automatically query a status via telnet (this isn't something I'm able to work around in this case). The idea is to grep for something and assign the result to a variable, to pass to a ...
0
votes
2answers
51 views

How to timeout a program with a potentially infinite loop

Suppose I run a program that I suspect to contain an infinite loop, or some other code that might run for too long. I know that in Linux I can do: timeout 1 ./program to give the program a time-out ...
2
votes
0answers
62 views

/sys/block/sd*/device/timeout not accurate

The default value for the timeout file for SCSI disks is 30, supposedly meaning 30s. In my dmesg logs, I find that the system is waiting 180s before timing out. Setting timeout to various values ...
0
votes
2answers
107 views

wget not downloading streaming mp3 correctly

I am trying to download a streaming mp3 using wget. this is my basic command: wget http://sj128.hnux.com/sj128.mp3 -c --timeout=1 --waitretry=0 --tries=0 -O "file.mp3" i have been doing this in a ...
1
vote
1answer
60 views

Stop netcat as soon as grep matches something

I am facing a problem using netcat in a bash script. I would like to match a specific output after sending a command and continue the script execution as soon as possible (not waiting for a netcat ...
1
vote
1answer
345 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
1answer
42 views

Coreutils timeout(1) plays badly with man/less

I want to set a timeout to the less(1) command on our company's production server. Everyday we produce large log files on it, and despite the nightly batch job to archive/remove them, we sometimes get ...
0
votes
0answers
21 views

Combining timeout and cpulimit

I have a situation where a process that hangs under certain circumstances or runs for too long should be killed. Also I don't want the process to take 100% of the CPU time. I am thinking that I should ...
1
vote
0answers
20 views

Having lot of timeouts since Ubuntu Cosmic [closed]

I am having lots of network timeout since I upgraded to 18.10 which is installed in dual-boot with Windows which isn't getting none. Is there some kind of configuration to make Linux's packet ...
0
votes
1answer
48 views

Maximum timeout for process

I have a script which I think can take few days to finish. Basically it submits slurm jobs when queue isn't full and in the process it can wait a while. The script results in incomplete results, ...
1
vote
2answers
268 views

Connection errors on Apache httpd proxy, but only for some vhost

I set up an Apache v2.4 reverse proxy on a CentOS 7 machine, serving requests to several vhosts; amongst these there are Atlassian application servers. The proxy's private IP address is 10.0.0.77, ...
2
votes
1answer
50 views

Suggested improvements to stream-recording script: timeout?

I'm trying to adapt the script below (taken from https://superuser.com/questions/181517/how-to-execute-a-command-whenever-a-file-changes) to cause my system to record a video stream whenever a ...
1
vote
1answer
15 views

Is there a timeout for the networksetup command on macOS?

I want to set a 1 second timeout for networksetup so the command does not take longer than 2 seconds at most.
1
vote
1answer
83 views

Timeout subprocess pid

I'm using the timeout utility inside a bash script to run a command for a given time (e.g., timeout -s SIGINT 500s ./my_script). I want to monitor the process myscript to see how much CPU/memory it ...
1
vote
1answer
114 views

The `read` builtin hangs indefinitely when used with `timeout`

The script below works perfectly with bash but not with sudo bash or sh. Pressing enter or ^C won't work. Only ^\ and ^Z work, but not with sudo bash. printf '#!/bin/sh\nread var\n' > myscript ...
2
votes
2answers
1k 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 ...
0
votes
1answer
11k views

How do I change dracut-initqueue timeout?

During boot, my CentOS 7 box yields a bunch of messages like [ 202.161851] myhost dracut-initqueue[381]: Warning: dracut-initqueue timeout - starting timeout scripts and then drops me to a prompt. I ...
1
vote
1answer
210 views

Unable to start firefox on centOs 6 from iterm2 on mac

I have installed firefox and xauth on the centOs 6.6 server as follows: sudo yum install firefox sudo yum install xauth On my mac, I am using iTerm2 On my iTerm2 session, I also exported my display ...
7
votes
3answers
14k 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 ...
0
votes
1answer
595 views

Curl request exits at five minutes unexpectedly

I'm using a shell script to fire off a curl request that deletes all documents of a certain type in my Elasticsearch cluster. If successful, Logstash starts and attempts to reindex the deleted type's ...
3
votes
1answer
2k 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, ...
2
votes
1answer
6k 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 ...
3
votes
2answers
125 views

Timeouts between an API and an elasticsearch server every 2 hours

We are experiencing a weird issue on our servers. (Debian 8.9) We have an API which is a PHP application. It requests an elasticsearch which instance is on a separate server. Every 2 hours, we are ...
2
votes
1answer
236 views

Timeout command breaks command that expects input

I need to execute a command with timeout so it's killed after X time. I have done tests and it only works when typed in the terminal directly, when in a bash script it seems to not handle the user ...
2
votes
1answer
476 views

Trap does not catch SIGTERM in child script

I have two scripts. First one is basically wrapper that calls subscript and sets timeout. #!/bin/bash # wrapper_script timeout --signal=SIGTERM 50 main_script.sh And if execution of main_script.sh ...
3
votes
0answers
111 views

Can you interrupt a soft NFS mount or does it need to timeout?

I know that with hard mounts the only way to interrupt them is to use the intr option (which is now deprecated). For soft mounts, however, do you need to wait for the timeout or can you interrupt them?...
1
vote
2answers
275 views

bash timeout command kills randomly before duration

I'm trying to show thumbnails from youtube for specific timeout to user and then show next one I made this command: while read line; do\ wget -O- -q "$line" | \ timeout 10s display ;\ ...
0
votes
2answers
195 views

Generate random number for x amount of time in BASH

I would like to generate random numbers for "x" amount of time, but I'm not sure how to make it run for x amount of time (like 2 minutes for example).
2
votes
2answers
2k 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 ...
1
vote
1answer
778 views

how to get the timeout exit code while run a command in background?

I'm writing a shell script to run ping command in background, and in the same time, set a timeout value for ping command, I want to get the exit code if the ping is ended by timeout, I use below: ...
0
votes
1answer
374 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 ...
0
votes
1answer
1k views

timeout causes while read loop to end when `cat` is timed out

I am unable to discern why timeout in a function call will cause a loop to stop. I have a "solution", but I am really very intrigued as to how / why this is happening! It seems to be something to do ...
2
votes
2answers
1k views

Time limit for bash script

I have bash script and I would like to set time limit for it. For example if scripts runs longer than 50s, exit with 0. It should be done inside script, I can not change the command how script is ...
2
votes
1answer
48 views

Schedule cancellable script to run after duration

I want to be able to run a script after a certain duration has elapsed. I also want to be able to cancel it and reschedule it, i.e. increase the duration on-the-fly. I was thinking of somthing like ...
2
votes
1answer
786 views

Systemd - restart service if it is activating too long

I have a systemd service and some ExecStartPost scripts. Sometimes these scripts may take a long time. While these scripts are executing, service is in "activating" state. Is there any way to set an ...
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 ...
1
vote
0answers
194 views

Timeout when mounting EFS on EC2

Let us say I have an EC2 VM which we will call V in security group S1. I have an EFS mount point which we will call M in security group S2. Everything is in the same VPC, on the same subnet, in the ...
1
vote
1answer
579 views

How to get raw output of showkey for use in a script? [closed]

I want to get the output of showkey for use in a script, without the 10 second limitation.
10
votes
2answers
12k 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 ...
5
votes
3answers
4k 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 ...
1
vote
2answers
737 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 $$...
1
vote
1answer
152 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 ...
6
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, ...
0
votes
1answer
789 views

timeout command and pipe - order of precedence

I need to test receipt of TCP data. I may not use iperf. The requirements are saying that I should create a TCP server to which will someone will send random data. I need to count the number of ...
1
vote
1answer
514 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 ...
3
votes
3answers
881 views

Pass-through pipe with timeout

How can I implement a timeout when no data is being passed through a pipe? It would act as watchdog with following usage: process1 | watchdog --timeout 60 | process2 When no data pipes through I ...
1
vote
0answers
567 views

FreeBSD pkg installation operation timed out error

I'm trying to install some packages in FreeBSD. I got this timed out error during installation of gnome3 also.Now I'm trying to install Firefox and again same error. Can anyone give me solution for ...
2
votes
2answers
4k views

Tcpdump - counting outgoing and incoming UDP packets

Is it possible with tcpdump to count (for some set up time) the number of outgoing and incoming UDP packets? I don't have much experience in tcpdump, so an advice how to do that would be very helpful....