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
1answer
29 views

How to forcefully close a ssh connection is the command on the target server never returns

I have an automation tool that generates and executes the below command that fires rpm -qa grep httpd on the target host 10.9.100.67. ssh -vvv -o StrictHostKeyChecking=no -o 'IdentityFile="/app/...
0
votes
0answers
35 views

GNU Screen ssh session timeout

I'm using GNU screen under Centos to SSH to devices. I'm experiencing an issue where the device (firewall) has a hard timeout for ssh session for 8 hours, so if there is no interaction with it, ssh ...
0
votes
1answer
27 views

how to repeatedly stop and restart a command

I'm trying to find a simple way to repeatedly restart a command after a certain time (let's say 10 seconds for the purpose of this question). For simplicity let's say the command in question is htop -...
0
votes
0answers
59 views

NetworkManager/networkd/netplan: Would this NetworkManager error be eliminated with networkd?

I'm using NetworkManager on my Ubuntu 18.04 desktop/server machine to manage four static IP addresses as well as my WiFi. It generally works fine, except for once or twice a day, I get errors like ...
0
votes
1answer
47 views

Timed tcpdump: pipe is slow

What I actually want to do is measure tcpdump for 10s. $ timeout 10s tcpdump > my.log but I found there has only a short period actually being logged, instead of whole 10s. therefore I did this ...
-1
votes
1answer
45 views

Get the exit code before disown

I am executing a command using timeout in the following way that waits for seconds and then exits timeout -k 1 10 <command> &> error.log & disown % However, I've realized that since ...
0
votes
1answer
739 views

ssh: connect to host host port 22: Connection timed out | No firewall

I have a Debian server and I'm trying to access it by ssh from another server and I'm getting timeout error. I have no iptables rules on any of them, and actually I can ssh to target host from any ...
0
votes
0answers
59 views

Can't connect SSH from VM to other computer

I connected on my network, two computers, one is hosting a virtual machine(CentOS) connected as Bridge, the other is a Debian. Host (Windows 10 - 10.10.10.2) - Vm (10.10.10.3) - Debian(10.10.10.4) I ...
0
votes
1answer
46 views

If someone logs into serial and exits console without logout, how do I automatically logout?

am using a debian based linux system. There is a console access to it via Lantronix SLC8000 Advanced Console Manager. When I login it asks for username and password (Both Console manager and server ) ...
0
votes
0answers
51 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
107 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
68 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
73 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
60 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
54 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
143 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
123 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
226 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
213 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
214 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 ...
1
vote
1answer
2k 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 <<>&...
1
vote
3answers
108 views

TMOUT within script file misbehaves for the select command. How to fix it?

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
365 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
163 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
108 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
70 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
792 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
548 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 ...
3
votes
0answers
417 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
820 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
296 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 ...
3
votes
1answer
3k 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
128 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
466 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
713 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
83 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
153 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
265 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
318 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 ...
4
votes
2answers
4k 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 ...
1
vote
3answers
23k 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
344 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 ...
14
votes
3answers
27k 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
1k 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
5k 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
13k 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
242 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
293 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 ...
3
votes
1answer
829 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
148 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?...