Linux Commands Examples

A great documentation place for Linux commands

timeout

run a command with a time limit


see also : kill

Synopsis

timeout [OPTION] DURATION COMMAND [ARG]...
timeout
[OPTION]


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
DISPLAY=localhost:0 timeout 10 glxinfo
0
source
            
framework_failure_ "$STRACE is not available"
TIMEOUT="timeout -s 9 $TIMEOUT_DURATION"
$TIMEOUT true > /dev/null 2>&1 ||
TIMEOUT=
exec $TIMEOUT "$@"
0
source

Putty Network Error: Software caused connection abort

You need to enable TCPKeepAlive on Linux.

It's explained in PuTTy's FAQ on the web site, when you're searching for this error.

0
source

Ubuntu PPPoE connection timeout

Does it work (can you use it/surf) for those 3-4 minutes ?

I really am no ppp/pppoe expert, but this looks just twisted:

May 2 12:16:37 solomongaby-laptop pppd[7313]: local IP address 79.119.100.50
May 2 12:16:37 solomongaby-laptop pppd[7313]: remote IP address 10.0.0.1

Can you maybe try to sniff the traffic with wireshark ?

If you are really lucky, your modem offers some debugging. Mine had syslog-output, which was easily configured.

0
source

Change password timeout on Linux?

change the FAIL_DELAY line in /etc/login.defs. That should affect both login and su. But why would you want to do that ?

0
source

How can I get ping timeout below 1 second?

Found a similar question out there, and the answer was a ping alternative called fping. Maybe it'll be of some use to you. http://serverfault.com/questions/200468/how-can-i-set-a-short-timeout-with-the-ping-command

0
source

How can I change the time before the system locks?

For Fedora 14, it is in the screensaver settings under something like "require password to return from screensaver." I don't remember the exact phrasing as I am not booted in fedora at the moment.

EDIT: I am running GNOME with Fedora 14.

0
source

How can I setup a display time switch

If you couple MultiMonitorTool with Task Scheduler you should be able to achieve your rotation. I haven't used it before but according to it's command line options it should work. A possible command from the command line could look like this:

MultiMonitorTool.exe /enable 1 /SetPrimary 1 /disable 2 3

There's also an option to move existing windows to the new primary display:

/MoveWindow

You may also want to look into the /SetNextPrimary option.

This solution is, of course, Windows only.

0
source

Timeout in whois command

I have the same thing happening and it's almost certainly because one of the central whois servers has blocked you for too many queries. I suspect it's Verisign's .com server that is being touchy as I can get names lik

I haven't yet found out a way to remove myself from the block list but am working on it and would appreciate hearing anything you find out!

To test this, try a whois of flabbalabbaz.info - you'll get an immediate response; then try a whois of flabbalabbaz.com or .net - you'll time out.

The most usual cause of getting blacklisted is too many queries from some sort of automated system. We have a whois script built into one of our helpdesk operators' tools, but it doesn't actually issue many requests so I'm rather disappointed they've seen fit to block us for what would only have been a relatively small number of queries.

0
source

Troubleshooting timeout and login problem, data transfer logging

I dug deeper, and the problem was that my router wasn't giving me the correct IP address from the DNS. Switching to OpenDNS or Google's DNS servers solved it. The sort of tool I was looking for would be wireshark, however I solved the problem before I saw wireshark.

0
source

Linux timeout if no output

It seems to me like you may want to approach the problem differently. Assuming you're connecting to the remote server via SSH, you should consider launching the process in such a way that the SSH connection can hang up normally and the process continue to execute. It would ultimately look something like:

nohup script.sh > /dev/null 2>&1 &

This uses the nohup command to execute script.sh in a way that is immune to hang-ups, redirecting STDIN/STDOUT to the discard bin (/dev/null) and then backgrounding the process. This should release the TTY used for the initial connection and allow the process to continue to run in the background even after the session (and TTY) are closed.

description

Start COMMAND, and kill it if still running after DURATION.

Mandatory arguments to long options are mandatory for short options too.

--foreground

When not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and receive TTY signals. In this mode, children of COMMAND will not be timed out.

-k, --kill-after=DURATION

also send a KILL signal if COMMAND is still running this long after the initial signal was sent.

-s, --signal=SIGNAL

specify the signal to be sent on timeout. SIGNAL may be a name like ’HUP’ or a number. See ’kill -l’ for a list of signals

--help

display this help and exit

--version

output version information and exit

DURATION is a floating point number with an optional suffix: ’s’ for seconds (the default), ’m’ for minutes, ’h’ for hours or ’d’ for days.

If the command times out, then exit with status 124. Otherwise, exit with the status of COMMAND. If no signal is specified, send the TERM signal upon timeout. The TERM signal kills any process that does not block or catch that signal. For other processes, it may be necessary to use the KILL (9) signal, since this signal cannot be caught. If the KILL (9) signal is sent, the exit status is 128+9 rather than 124.

copyright

Copyright © 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

reporting bugs

Report timeout bugs to bug-coreutils[:at:]gnu[:dot:]org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
Report timeout translation bugs to <http://translationproject.org/team/>


bugs

Some platforms don’t curently support timeouts beyond 2038


see also

kill

The full documentation for timeout is maintained as a Texinfo manual. If the info and timeout programs are properly installed at your site, the command

info coreutils 'timeout invocation'

should give you access to the complete manual.


author

Written by Padraig Brady.

How can this site be more helpful to YOU ?


give  feedback