🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #6540

Re: Como hacer que un programa se detenga si dura más de 5 s, pudiendo haber muchos otros?

#6540
From: J.A. Gutierrez
Date: Tue, 17 Jun 2003 07:54
29 lines
1984 bytes
Pascal Bourguignon <spam@thalassa.informatimago.com> wrote:
: Marc <e7633648@est.fib.ucp.es> writes:

:> 
:> PID=programa &
:> sleep 2
:> kill $PID

	si el programa termina antes de dos segundos, puede darse
	el caso (poco probable) de que el PID se haya reutilizado

: Tanbien es posible dejar el systema hacerlo con ulimit:

: $ help ulimit|grep time
:         -t      the maximum amount of cpu time in seconds
:         
: (Pero cuidado: es  el tiempo CPU, no el tiempo reloj.  Es decir que si
: el proceso no usa la CPU, no pasa nada).

	solucion: utilizar algun programa tipo watchdog, como p.e.
	timeout. Hay una copia en
	http://phoebe.cps.unizar.es/~spd/src/other/timeout-1.0.tar.gz


-- 
PGP and other useless info at      \
http://www.cps.unizar.es/~spd/      \
finger://daphne.cps.unizar.es/spd    \       Timeo Danaos et dona ferentes
ftp://ivo.cps.unizar.es/pub/          \                         (Virgilio)   
Technical Details
Message-ID: <bcmhfd$989$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.rediris.es!bashful.rediris.es!news.unizar.es!not-for-mail
References: <3EEB0096.4090802@us.es> <bcf7hf$4pp$1@news.ya.com> <87n0gkozz9.fsf@thalassa.informatimago.com>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: f86c8,c4ba89e2fe1df8b0
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-06-17 00:58:01 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.rediris.es!bashful.rediris.es!news.unizar.es!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Como hacer que un programa se detenga si dura más de 5 s, pudiendo haber muchos otros?
Date: 17 Jun 2003 07:54:21 GMT
Organization: Rank
Lines: 29
Message-ID: <bcmhfd$989$1@news.unizar.es>
References: <3EEB0096.4090802@us.es> <bcf7hf$4pp$1@news.ya.com> <87n0gkozz9.fsf@thalassa.informatimago.com>
NNTP-Posting-Host: daphne.cps.unizar.es
X-Trace: news.unizar.es 1055836461 9481 155.210.152.20 (17 Jun 2003 07:54:21 GMT)
X-Complaints-To: usenet@news.unizar.es
NNTP-Posting-Date: 17 Jun 2003 07:54:21 GMT
User-Agent: tin/1.4.7-20030322 ("Suggestions") (UNIX) (IRIX/6.2 (IP22))