@@ -, +, @@ --- tools/stage-marc-import.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/tools/stage-marc-import.pl +++ a/tools/stage-marc-import.pl @@ -122,10 +122,15 @@ if ($completedJobID) { exit 0; } elsif (defined $pid) { # child - # close STDOUT to signal to Apache that - # we're now running in the background + # close STDOUT/STDERR to signal to end CGI session with Apache + # Otherwise, the AJAX request to this script won't return properly close STDOUT; - # close STDERR; # there is no good reason to close STDERR + close STDERR; + my $logdir = C4::Context->config('logdir'); + if ($logdir && -d $logdir){ + my $logfile = sprintf("%s/%s",$logdir,'background-jobs.log'); + open(STDERR, '>>', $logfile); + } } else { # fork failed, so exit immediately warn "fork failed while attempting to run tools/stage-marc-import.pl as a background job: $!"; --