I found the script below and tried, but Using Apache for Win32 and IE 5.5 as
a client 
the client still waits for the child process to finish until it prints the
desired output and
brake the connection to the server.

Any Ideas?

Thanks 
Sascha

===============8<===============
#!C:\Perl\bin\perl.exe

my $path = "C:\\Programme\\Apache Group\\Apache\\htdocs\\test\\";
my $url = "http://myhost/test/";;

if ( ! defined ($pid = fork())) {

        die "Content-type: text/html\n\nUnable to fork: $!\n";

} elsif ( ! $pid ) {

        # this is the branch for the child process

        close (STDIN);
        close (STDOUT);
        close (STDERR);

        sleep ( 20 );

        $filename = $path . "A" . $$ . ".html";

        open ( OFD , "> " . $filename ) or die "Unable to open: $!";

        # open the file to write the results to
                print OFD "<HTML><BODY>";
                print OFD "The results of your query are 4 and 12.";
                print OFD "</BODY><HTML>";
                close ( OFD );

        exit;   # terminate the child process

} else {

        # this ist the branch for the parent
        print "Content-type: text/html\n\n";
        print "<html><body>";
        print "Your request has been received<br>";
        print "and is beeing processed.<br>";
        print "You can access the results at ";
        print "<a href=\"" . $url . "A" . $pid . ".html\">A" . $pid .
".html</a> ";
        print "once completed.";
        print "</body></html>";
        exit;   # terminate the parent process

}
===============8<===============


> -----Urspr�ngliche Nachricht-----
> Von:  William R. Mussatto [SMTP:[EMAIL PROTECTED]
> Gesendet am:  Freitag, 30. Mai 2003 17:57
> An:   [EMAIL PROTECTED]
> Betreff:      Re: How to run a long time cgi-program
> 
> > Hello List,
> >
> > I am writing a perl-cgi-script who lasts a long time before it finishes
> > its work. But the Webserver kills the perl-script after some time. I
> > don't  want to put up the time in the webservers configuration. Is there
> > another way to keep the program running and reporting back to the
> > webbrowser?
> >
> > Thank you in advance
> > Sascha
> First, disclaimer: I've done this on a Linux box but never on a win32 box.
> 
> The trick is to create a child process after having closed  standard out
> and then terminate the parent.  The problem then becomes for the
> webbrowser to periodically check on the status of the child.  This could
> be done by using a meta refresh tag which would call a second program to
> display the progress. The second program would continue refreshing itself
> until the child has completed its task.
> 
> William R. Mussatto, Senior Systems Engineer
> Ph. 909-920-9154 ext. 27
> FAX. 909-608-7061
> 
> 
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to