Thread Aus Perlscript Programm aufrufen und nicht auf Beendigung warten (8 answers)
Opened by Superfrank at 2009-08-04 10:11

topeg
 2009-08-04 12:11
#123861 #123861
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
Eigentlich sollte es funktionieren, wenn das Script auch etwas wenig Fehlerbehandlung macht.

Versuch es mal so:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
$| = 1;
$SIG{CHLD}='IGNORE';

print "Content-type: text/plain", "\n\n";
print "We are about to create the child!", "\n";
my $pid=fork;

if (!defined($pid)) { print "Fork Failed! ($!)\n"; }
elsif($pid>0)
{
  print <<End_of_Parent;
I am the parent speaking. I have successfully created a child process.
The Process Identification Number (PID) of the child process is: $pid.
The child will be cleaning up all the files in the directory. It might
take a while, but you do not have to wait!
End_of_Parent

} else {
  close (STDOUT);
  exec("sleep 100");
  exit(0);
}
print "I am the parent again! NOAow it is time to exit.", "\n";
print "My child process will work on its own! Good Bye!", "\n";

View full thread Aus Perlscript Programm aufrufen und nicht auf Beendigung warten