|
Lines 31-36
use CGI qw ( -utf8 );
Link Here
|
| 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 |
use Net::Server::Daemonize qw(daemonize); |
|
|
34 |
use File::Temp qw(tempdir); |
| 34 |
|
35 |
|
| 35 |
# Koha modules used |
36 |
# Koha modules used |
| 36 |
use C4::Context; |
37 |
use C4::Context; |
|
Lines 120-129
if ($completedJobID) {
Link Here
|
| 120 |
exit 0; |
121 |
exit 0; |
| 121 |
} elsif (defined $pid) { |
122 |
} elsif (defined $pid) { |
| 122 |
# Daemonize the child process os the parent will print its output |
123 |
# 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 |
# deamonize requires a pid file even though it is supposed to be optional |
|
|
125 |
my $dir = tempdir( CLEANUP => 1 ); |
| 126 |
my $pidfile = "$dir/async$$.pid"; |
| 124 |
my @current_user = getpwuid($<); |
127 |
my @current_user = getpwuid($<); |
| 125 |
daemonize( $current_user[2], $current_user[3], $pidfile ); |
128 |
daemonize( $current_user[2], $current_user[3], $pidfile ); |
| 126 |
unlink($pidfile); # otherwise it doesn't go away |
|
|
| 127 |
# child |
129 |
# child |
| 128 |
# close STDOUT to signal to Apache that |
130 |
# close STDOUT to signal to Apache that |
| 129 |
# we're now running in the background |
131 |
# we're now running in the background |
| 130 |
- |
|
|