@@ -, +, @@ updating, and allow use of plack for Stage MARC Import out the lines for stage-marc-import.pl and background-job-progress.pl --- debian/templates/apache-shared-intranet-plack.conf | 2 -- tools/stage-marc-import.pl | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) --- a/debian/templates/apache-shared-intranet-plack.conf +++ a/debian/templates/apache-shared-intranet-plack.conf @@ -12,11 +12,9 @@ # FIXME: These scripts should be fixed so they # don't break under plack/starman ProxyPass "/cgi-bin/koha/offline_circ/process_koc.pl" "!" - ProxyPass "/cgi-bin/koha/tools/background-job-progress.pl" "!" ProxyPass "/cgi-bin/koha/tools/batch_record_modification.pl" "!" ProxyPass "/cgi-bin/koha/tools/batchMod.pl" "!" ProxyPass "/cgi-bin/koha/tools/manage-marc-import.pl" "!" - ProxyPass "/cgi-bin/koha/tools/stage-marc-import.pl" "!" ProxyPass "/cgi-bin/koha/tools/upload-cover-image.pl" "!" ProxyPass "/cgi-bin/koha/svc/cataloguing/metasearch" "!" --- a/tools/stage-marc-import.pl +++ a/tools/stage-marc-import.pl @@ -30,6 +30,7 @@ use Modern::Perl; use CGI qw ( -utf8 ); use CGI::Cookie; use MARC::File::USMARC; +use Net::Server::Daemonize qw(daemonize); # Koha modules used use C4::Context; @@ -118,10 +119,15 @@ if ($completedJobID) { print '{"jobID":"' . $jobID . '"}'; exit 0; } elsif (defined $pid) { + # Daemonize the child process os the parent will print its output + my $pidfile = "/tmp/async$$.pid"; # deamonize requires a pid file even though it is supposed to be optional + my @current_user = getpwuid($<); + daemonize( $current_user[2], $current_user[3], $pidfile ); + unlink($pidfile); # otherwise it doesn't go away # child # close STDOUT to signal to Apache that # we're now running in the background - close STDOUT; + close STDOUT; # FIXME I think this is no longer necessary # close STDERR; # there is no good reason to close STDERR } else { # fork failed, so exit immediately --