Interrupting program from command line

Igor Pechtchanski pechtcha@cs.nyu.edu
Thu Jun 26 22:23:00 GMT 2003


On Thu, 26 Jun 2003, Alex Vinokur wrote:

> Hi,
>
> I have some program that works endlessly.
> I want the program to be interrupted in some time after starting.
> Is it possible to do that from command?
>
> Something like (pseudo-code) :
> $ run 6 sec my_program,
>
>    Alex Vinokur

Sure.  Write a script that saves the PID, starts a timer, and kills the
child on timeout (you'll need to clean up the timer if the child finishes
earlier).  Or take advantage of a script that's already written, e.g.,
<http://www-124.ibm.com/developerworks/oss/cvs/jikesrvm/rvm/regression/limited.sh?rev=1.5>.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list