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
0
votes
0answers
16 views

ssh session for Azure CentOS virtual machine keeps getting disconnected after only few seconds of inactivity

ssh session with PuTTY to an Azure CentOS virtual machine keeps getting disconnected after only few seconds of inactivity. Also i am running a self developed process that gets killed for no reason .. ...
3
votes
2answers
61 views

Adding a timeout to a parallelized call in Bash

I have a simple Bash script I am running to parallelize and automate the execution of a program written in Sage MATH: #!/bin/bash for i in {1..500}; do echo Spinning up threads... echo Round $i ...
0
votes
0answers
27 views

Apache timeout only on port 80

I have installed debian 10 on my pc, i installed apache2 and i'm trying to bind a domain to my pc I've added in my router's forwarding the port 80. When i enter to the domain from my browser i can ...
0
votes
0answers
29 views

How make timeout docker container after restart server?

sudo docker run --restart always -itd I need to make a docker container start timeout after rebooting the machine. About 10 seconds. the container starts after rebooting itself --restart always, but ...
0
votes
0answers
24 views

Script to set sudo timeout

I would like to use a script to change the sudo timeout of a machine in an automated fashion. Everything I've found online related to changing the sudo timeout is in regards to visudo and manually ...
0
votes
0answers
31 views

How can I kill a process if it exceeds a timeout duration while also measuring its resource usage?

I'm currently using GNU time to measure the memory usage and runtime of a program. This is working great. However, I have noticed that in rare cases the program in question never exits, or takes a ...
3
votes
1answer
40 views

Linux timeout command using actual time? Broken binary?

I want to have timeout kill a script after one hour. On debian I run timeout 1h <script> and it simply works. On my arch linux machine, things are different. After trying some stuff I think I ...
1
vote
1answer
53 views

Perform special action on bash timeout

This question is related only to bash, no ssh or any other tool. I would like to detect a bash timeout, and only a timeout: I am NOT interested in any other exit conditions (exit, EOF, ^D, or ...
1
vote
0answers
71 views

Timeout shell commands without the timeout command when job control is not available

I would like to automate the process of doing some benchmarks on a remote device using a serial connection, the benchmarks could potentially fail without stopping, so I would like to add a timeout to ...
0
votes
1answer
84 views

Timeout for function in the kernel

I'm trying to add a timeout for a c function in the kernel. I'd like to do something like the function try_until_timeout of the following pseudocode: void myfunction() {/* [...] */} void ...
3
votes
3answers
118 views

tail a log util keywords found or timeout

I'm using a special way that can let me visit google. It is very different in the page now... So I can edit the question and comment the answers normally. I deleted more early discussions and go to ...
0
votes
1answer
400 views

Dig: connection timed out; no servers could be reached. But ping works?

When I try to run the dig command against either my servers IP or nameserver I get an error: root@kali2:/etc# dig q-type=soa @192.168.100.10 ; <<>> DiG 9.11.4-P2-3-Debian <<>&...
0
votes
1answer
58 views

TMOUT within script file misbehaves while it works in shell prompt fine. How to make it work?

UPDATE - looks like this is something peculiar with bash 4.3.42 as it works fine with 4.3.46. Leaving this post for those who run into the same issue in future. When I run this command in bash ...
0
votes
1answer
157 views

Why does dig utility hang indefinitely even with timeout specified?

I'm using dig utility to find public IP address. The command I used is: dig +short myip.opendns.com @resolver1.opendns.com but I had problem since on some other computers it took so long, so I ...
1
vote
0answers
81 views

Setting a timeout and limiting memory of a process

I'm trying to run a large process on my machine with a timeout and maximum memory limit. For handling the memory usage, I created a cgroup and use this shell script to start the process: #!/usr/bin/...
0
votes
1answer
76 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
55 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
430 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
318 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
250 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
475 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
176 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 ...
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
1answer
87 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
1answer
296 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
553 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
69 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
82 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.
2
votes
1answer
183 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
222 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 ...
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 ...
0
votes
2answers
17k 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
275 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 ...
12
votes
3answers
22k 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
790 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
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, ...
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 ...
3
votes
2answers
180 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
259 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
693 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
130 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
342 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
262 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).
6
votes
1answer
8k 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
1k 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
487 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
2k 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
2k 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
56 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 ...
3
votes
1answer
1k 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 ...