Article View: es.comp.os.linux.programacion
Article #6533Re: Como hacer que un programa se detenga si dura más de 5 s, pudiendo haber muchos otros?
From: ilagares
Date: Sun, 15 Jun 2003 10:44
Date: Sun, 15 Jun 2003 10:44
37 lines
2681 bytes
2681 bytes
No es por nada, pero con la RED-HAT que tengo la instrucci�n "ulimit" no est�, en cuanto a la opci�n anterior no es viable. Ya lo he probado. En cuanto al uso de cpu la salida de 'time' para los procesos da: > 0.010u 0.000s 0:00.71 1.4% 0+0k 0+0io 161pf+0w Y eso es con lo que cuento, no m�s. Por tanto sigo sin encontrar una soluci�n..... Pascal Bourguignon escribi�: > Marc <e7633648@est.fib.ucp.es> writes: > > >>No suelo hacer scripts, as� que no tengo mucha idea de lo que te voy a >>decir, pero a lo mejor esta idea te puede servir. Puedes probar ejecutando >>el programa en background, guardar su pid, y hacer que la siguiente >>instrucci�n sea un sleep de 1 o 2 segundos. Despu�s, la siguiente >>instrucci�n que sea un kill del pid anterior. Es decir, algo as�: >> >>PID=programa & >>sleep 2 >>kill $PID > > > Tanbien es posible dejar el systema hacerlo con ulimit: > > $ help ulimit|grep time > -t the maximum amount of cpu time in seconds > > $ ( ulimit -Ht 1 ; programa ) & > > (Pero cuidado: es el tiempo CPU, no el tiempo reloj. Es decir que si > el proceso no usa la CPU, no pasa nada). > >
Technical Details
Message-ID:
<3EEC4E0A.1060100@supercable.es>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!in.nntp.be!easynet-quince!easynet.net!bashful.rediris.es!newsfeed.bt.es!news.bt.es!not-for-mailReferences:
<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 X-Google-Thread: f86c8,c4ba89e2fe1df8b0 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-06-15 03:46:26 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!in.nntp.be!easynet-quince!easynet.net!bashful.rediris.es!newsfeed.bt.es!news.bt.es!not-for-mail From: ilagares <ilagares@supercable.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: Sun, 15 Jun 2003 12:44:26 +0200 Organization: Supercable Andalucia, S.A. Lines: 38 Message-ID: <3EEC4E0A.1060100@supercable.es> References: <3EEB0096.4090802@us.es> <bcf7hf$4pp$1@news.ya.com> <87n0gkozz9.fsf@thalassa.informatimago.com> NNTP-Posting-Host: 212.79.128.146 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: titan.bt.es 1055672556 22672 212.79.128.146 (15 Jun 2003 10:22:36 GMT) X-Complaints-To: abuse@bt.es NNTP-Posting-Date: 15 Jun 2003 10:22:36 GMT User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: es-es, es Cache-Post-Path: seux119!unknown@cliente-217217060231.ubrsed01.supercable.es X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)