[Ilugc] timeout in shell command

  • From: saikiranrgda@xxxxxxxxx (K. Sai Kiran)
  • Date: Sun Sep 9 20:02:34 2007

On Sun, 2007-09-09 at 05:36 -0700, Amit Dey wrote:

Assume that i have to execute a binary file 
  so i do
  ./binaryfilename
  Now there is a chance that the execution may run into an infinite loop.
   
  What i want is that if the execution has not completed in 10 seconds then 
it should be aborted and i should get some kind of signal for incomplete 
execution.

For example say you need to kill a process after waiting for ten secs or
so... you can try pushing it into back ground something like this..

./binaryfile &
pid=$!
sleep 10
kill -9 $pid


Kiran.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : 
http://www.ae.iitm.ac.in/pipermail/ilugc/attachments/20070909/e1909109/attachment.bin

Other related posts: