in reply to Re^3: exec command taking ages
in thread exec command taking ages

If the long-running process needs those handles (as it apparently does), try re-opening them to some file (before running the subprocess).

In some more detail, the undelying problem is that the implicitly forked subprocess running under nohup is getting duplicates of the file handles of the parent process (your main script) at the time of the fork, and all "instances" of those file handles - which are connected via pipes to the web server - will need to be closed (or re-opened to elsewhere), before the web server considers the CGI job completed.

-The other Anonymous Monk

Replies are listed 'Best First'.
Re^5: exec command taking ages
by pmcilfatrick (Initiate) on Nov 25, 2010 at 13:16 UTC

    Your comments helped resolve the issue!

    All I had to do was to change the exec line from:

    exec "nohup ./error_summariser.cgi $identifier > $default_files_dir/$i +dentifier/processing-log.txt &" or die "Can't exec: $!\n";

    to:

    exec "nohup ./error_summariser.cgi $identifier > $default_files_dir/$i +dentifier/processing-log.txt 2>/dev/null &" or die "Can't exec: $!\n" +;

    Adding the sending of standard error to the null device now lets the webpage complete immediately.

    Thanks for your help.

    Paul McIlfatrick