Article View: es.comp.os.linux.programacion
Article #15041Re: Programacion de demonios
From: J.A. Gutierrez
Date: Tue, 22 Aug 2000 00:00
Date: Tue, 22 Aug 2000 00:00
30 lines
1526 bytes
1526 bytes
Guido Reina <guido.reina@tecnet-sports.com> wrote:
: Me gustaria saber como se programa un demonio que se pueda lanzar desde
: un terminal, se quede residente, y se mantenga funcionando aunque se mate al
: terminal. Que se independice del terminal.
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char **argv, char **envp)
{
if (fork())
{
exit(0);
}
printf("%d\n",getpid());
sleep( atol( argv[1] ));
exit(0);
}
para hacerlo bien, hay que cerrar el std* y demas, pero
bueno, ya ves por donde va la cosa.
--
PGP and other useless info at \ Oh, show us the way
http://www.cps.unizar.es/~spd/ \ to the next whisky bar
finger://daphne.cps.unizar.es/spd \ Weill/Bretch
es doloroso ser sabio y descubrir la sopa de ajo (Pla)
Technical Details
Message-ID:
<8ntmc3$c1v$2@news.unizar.es>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8nr6fh$11h4t11@SGI3651ef0.iddeo.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit
X-Google-Thread: f86c8,a5c338c109de3a74
X-Google-Attributes: gidf86c8,public
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Subject: Re: Programacion de demonios
Date: 2000/08/22
Message-ID: <8ntmc3$c1v$2@news.unizar.es>
X-Deja-AN: 661079304
References: <8nr6fh$11h4t11@SGI3651ef0.iddeo.es>
X-Complaints-To: usenet@news.unizar.es
X-Trace: news.unizar.es 966941891 12351 155.210.152.20 (22 Aug 2000 10:58:11 GMT)
Organization: Rank
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (IRIX/6.2 (IP22))
NNTP-Posting-Date: 22 Aug 2000 10:58:11 GMT
Newsgroups: es.comp.os.linux.programacion