P
ph1975
Hi folks,
i created a perl Daemon with Win32:aemon;
This daemon forks some childs which walk through files and do some
stuff.
After the childs are finished, the parent also dies.
How can i prevent the Parent Process from terminating? The child
invokes a systemcall via system();
The System is Windows 2003 Enterprise Server.
i registered the perl Script in Windows Services and i am starting the
service via the administrative tools -> services.
Thanks a lot,
Philipp
Minimal code exerpt:
use Win32:aemon;
Win32:aemon::StartService();
use Proc::Queue;
use POSIX '_exit';
while(1)
{
my $State = Win32:aemon::State();
if( SERVICE_RUNNING == $State )
{
...
my $pid = fork();
push(@childs,$pid);
if($pid == 0) {
#child
if (-e $taskDirData . "_parsing\\" . $filename) {
$fileExist = " exist: yes";
....
Win32:aemon::State( SERVICE_RUNNING );
$cmdString =~ s/\\\\/\\\\\\\\/;
# Child-Prozess
my $result = system($cmdString); POSIX::_exit(0);
} else {
$fileExist = " exist: no";
}
} else {
# parent
# waitpid($pid,0);
# SysUtils->debugHandler(5, 0, "I", "Child " . $pid . "
terminated");
Win32:aemon::State( SERVICE_RUNNING );
}
} # delta
}
.....
i created a perl Daemon with Win32:aemon;
This daemon forks some childs which walk through files and do some
stuff.
After the childs are finished, the parent also dies.
How can i prevent the Parent Process from terminating? The child
invokes a systemcall via system();
The System is Windows 2003 Enterprise Server.
i registered the perl Script in Windows Services and i am starting the
service via the administrative tools -> services.
Thanks a lot,
Philipp
Minimal code exerpt:
use Win32:aemon;
Win32:aemon::StartService();
use Proc::Queue;
use POSIX '_exit';
while(1)
{
my $State = Win32:aemon::State();
if( SERVICE_RUNNING == $State )
{
...
my $pid = fork();
push(@childs,$pid);
if($pid == 0) {
#child
if (-e $taskDirData . "_parsing\\" . $filename) {
$fileExist = " exist: yes";
....
Win32:aemon::State( SERVICE_RUNNING );
$cmdString =~ s/\\\\/\\\\\\\\/;
# Child-Prozess
my $result = system($cmdString); POSIX::_exit(0);
} else {
$fileExist = " exist: no";
}
} else {
# parent
# waitpid($pid,0);
# SysUtils->debugHandler(5, 0, "I", "Child " . $pid . "
terminated");
Win32:aemon::State( SERVICE_RUNNING );
}
} # delta
}
.....