Hi all, I have a report creation perl script that takes about 15 minutes to run and I need to fork it. I tried the code from v1:
use strict; use POSIX 'setsid'; use Apache::SubProcess; my = shift; ->send_http_header("text/plain"); {CHLD} = 'IGNORE'; defined (my = fork) or die "Cannot fork: \n"; if () { print "Parent 25481 has finished, kid's PID: \n"; } else { ->cleanup_for_exec(); # untie the socket chdir '/' or die "Can't chdir to /: "; open STDIN, '/dev/null' or die "Can't read /dev/null: "; open STDOUT, '>/dev/null' or die "Can't write to /dev/null: "; open STDERR, '>/tmp/log' or die "Can't write to /tmp/log: "; setsid or die "Can't start a new session: "; select STDERR; local $| = 1; warn "started\n"; # do something time-consuming sleep 1, warn "sh\n" for 1..20; warn "completed\n"; CORE::exit(0); # terminate the process } First problem, Apache::SubProcess doesn't seem to contain those methods anymore. Second problem is open. Can anyone tell me the proper way to fork with v2? Thanks, Cameron