delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/26/16:48:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Hannu E K Nevalainen \(garbage mail\)" <garbage_collector AT telia DOT com>
To: "Alex Vinokur" <alexvn AT connect DOT to>, <cygwin AT cygwin DOT com>
Subject: RE: Interrupting program from command line
Date: Thu, 26 Jun 2003 22:46:23 +0200
Message-ID: <NGBBLLIAMFLGJEOAJCCEAECLDBAA.garbage_collector@telia.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
In-Reply-To: <bdf76p$dc4$1@main.gmane.org>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Importance: Normal

> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com]On Behalf
> Of Alex Vinokur

> 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,

 I think it should be possible to create a script that does this, with the
help of the internal job control of bash. i.e. catch the PID of a started
job in a bash variable (e.g. set TASK_PID=`...`), then 'sleep' for a number
of seconds and finally 'kill -9' $TASK_PID .

Reference:
---
$ info bash
/job

Manual example:
---
Hannu AT P450 ~
<xc=0> $ sleep 120 &
[1] 748
Hannu AT P450 ~
<xc=0> $ kill -9 748
Hannu AT P450 ~
<xc=0> $ jobs
[1]+  Killed                  sleep 120

/Hannu E K Nevalainen, 59~14'N, 17~12'E
 ~ <=> degree

--

--END OF MESSAGE--


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019