[Ilugc] One Day One Command (TIMEOUT)

  • From: sbharathi@xxxxxxxxxxxxx (Bharathi Subramanian)
  • Date: Thu Aug 25 15:51:06 2005

Linux Gazette, "...making Linux just a little more fun!", is a
free online magazine that provides many Linux tips & tricks.  
URL: http://linuxgazette.net/ and http://linuxgazette.com/

One Day One Command 
===================

timeout -- Send a signal to a program after a certain timeout.

Summary:

'timeout' executes a program (with arguments args) and sends a signal
(like KILL, TERM etc) to it after a certain amount of seconds. It is 
from NetaTalk Project.

Examples:

$ timeout 10 ping localhost -- Run the Ping program and send, by
                             default, a SIGTERM after 10 seconds.

$ timeout -s KILL 10 ping localhost -- Same as above. But here KILL 
           Signal will be send to the Ping Program after 10 seconds.

$ timeout -s HUP 10 sh -- Spawn a shell and send a hangup signal after 
                          10 seconds.

$ timeout -s 1 10 sh -- Same as above. Signal #1 == HANGUP.

Read: man timeout & man 7 signal

HTH :)
--
Bharathi S
ODOC LJ -- http://www.livejournal.com/community/ilugc/

Other related posts:

  • » [Ilugc] One Day One Command (TIMEOUT) - Bharathi Subramanian