🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread en un script bash

#13304
From: Mario Teijeiro Otero
Date: Thu, 08 Mar 2001 13:57
39 lines
1887 bytes
TvX wrote:

> Hola, quiz� sea una pregunta irresoluble, pero me gustar�a saber si hay
> alguna manera de hacer que en un script bash se ejecute cada cierto
> tiempo una funcion o comando

puedes llamar a la funci�n con & al final: 

Ejemplo:
---------------8<-------------
#!/bin/sh
 
function thread (){
        while true ; do
                sleep 1;
                echo "hola";
        done
}
 
thread & 
sleep 5


--------------------->8---------

Este tiene un problema, que cuando el script principal
finalice, sigue ejecut�ndose thread indefinidamente.
Supongo que hay alguna manera de lanzarlo y que 
muera cuando el padre (el script) termine.

Saludos
-- 
 Los dedos molan. Siempre puedes contar con ellos. 

"Yo uso software libre" (declaraci�n a petici�n de Richard M. Stallman)

Mario Teijeiro Otero           mailto:asimovi at teleline dot es         
NiCK: emeteo en irc (#debian, #java, #escomposlinux).
clave: correo con Asunto: "[PGPKEY]"     Usr. Reg. 122438               
Technical Details
Message-ID: <d33889.7vi.ln@asimovi.localdomain>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.mad.ttd.net!asimovi.localdomain!nobody
References: <slrn9aevu3.212.tovaritx@su27.tovaritx.red>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,6c1786098beee5a2
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-03-08 13:36:10 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.mad.ttd.net!asimovi.localdomain!nobody
From: Mario Teijeiro Otero <mteijeiro@NOSPAMescomposlinux.org>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Thread en un script bash
Date: Thu, 8 Mar 2001 14:57:00 +0100
Organization: Telefonica Transmision de Datos
Lines: 40
Message-ID: <d33889.7vi.ln@asimovi.localdomain>
References: <slrn9aevu3.212.tovaritx@su27.tovaritx.red>
NNTP-Posting-Host: 193-153-223-181.uc.nombres.ttd.es
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
User-Agent: KNode/0.4