Lines 30-35
use Modern::Perl;
Link Here
|
30 |
use CGI qw ( -utf8 ); |
30 |
use CGI qw ( -utf8 ); |
31 |
use CGI::Cookie; |
31 |
use CGI::Cookie; |
32 |
use MARC::File::USMARC; |
32 |
use MARC::File::USMARC; |
|
|
33 |
use Net::Server::Daemonize qw(daemonize); |
33 |
|
34 |
|
34 |
# Koha modules used |
35 |
# Koha modules used |
35 |
use C4::Context; |
36 |
use C4::Context; |
Lines 118-127
if ($completedJobID) {
Link Here
|
118 |
print '{"jobID":"' . $jobID . '"}'; |
119 |
print '{"jobID":"' . $jobID . '"}'; |
119 |
exit 0; |
120 |
exit 0; |
120 |
} elsif (defined $pid) { |
121 |
} elsif (defined $pid) { |
|
|
122 |
# Daemonize the child process os the parent will print its output |
123 |
my $pidfile = "/tmp/async$$.pid"; # deamonize requires a pid file even though it is supposed to be optional |
124 |
my @current_user = getpwuid($<); |
125 |
daemonize( $current_user[2], $current_user[3], $pidfile ); |
126 |
unlink($pidfile); # otherwise it doesn't go away |
121 |
# child |
127 |
# child |
122 |
# close STDOUT to signal to Apache that |
128 |
# close STDOUT to signal to Apache that |
123 |
# we're now running in the background |
129 |
# we're now running in the background |
124 |
close STDOUT; |
130 |
close STDOUT; # FIXME I think this is no longer necessary |
125 |
# close STDERR; # there is no good reason to close STDERR |
131 |
# close STDERR; # there is no good reason to close STDERR |
126 |
} else { |
132 |
} else { |
127 |
# fork failed, so exit immediately |
133 |
# fork failed, so exit immediately |
128 |
- |
|
|