Article View: es.comp.os.linux.programacion
Article #11315Re: Demonio en Perl (II) - lanzar proceso en background
From: Angels Flores
Date: Fri, 07 Dec 2001 06:32
Date: Fri, 07 Dec 2001 06:32
37 lines
2023 bytes
2023 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hola!
Gracias por vuestra ayuda, al final he conseguido solucionarlo :-)
Lo que hago es crear un hijo que lance el proceso con un system en
lugar de con un exec, cuando acaba hago un exit(0). El padre hace un
wait:
elsif ($accio eq "accio: Arrencar"){
defined(my $pid2 = fork) or die "No se puede
hacer el fork: $!";
if ($pid2==0){
print"$data Arrancar\n";
system('/var/www/html/encoder/configuracio');
#print"Soy el hijo, el pid tiene que ser 0 ->
$pid2\n";
exit(0);
}
else{
wait;
#print"Soy el padre, el pid de mi hijo es
$pid2\n";
}
}
- --
~A~
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPBBidYbSNjHGyYdxEQJWggCfd5QSb3Hmex0yNJ7w/DGkAe47/FQAniIb
5qU7BPi9qpiNDKnJ9VzkYBvs
=1I+I
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<9upnc1$3qt$1@diana.bcn.ttd.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mailReferences:
<9uifou$9rt$1@diana.bcn.ttd.net> <87itbk4iaf.fsf@eb2ebu.ampr.org>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII-7-bit X-Google-Thread: f86c8,5f00732518df3fe X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2001-12-06 22:32:44 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mail From: "Angels Flores" <aflores@laviniatv.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: Demonio en Perl (II) - lanzar proceso en background Date: Fri, 7 Dec 2001 07:32:24 +0100 Organization: Telefonica Transmision de Datos Lines: 40 Message-ID: <9upnc1$3qt$1@diana.bcn.ttd.net> References: <9uifou$9rt$1@diana.bcn.ttd.net> <87itbk4iaf.fsf@eb2ebu.ampr.org> NNTP-Posting-Host: 212.9.66.141 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000