in reply to Perl modules for batch web processing
After more XP I sugest to you eval a code like this:
Code don't tested, it's my concept ideas arround your question. See other response nodes, they have good ideas and complete my node :)use CGI; use POSIX qw(setsid); use Fcntl qw(:flock); ... my $Session = ... ... without session ... deny access my $SessionFile = "/tmp/$Session"; # Touch control file unless ( -f $SessionFile ) { open(C, ">$SessionFile"); close(C) } unless ( open(F, "+< $SessionFile") ) { print $q->h1("Session control failure"); exit 1; } unless ( flock(F, LOCK_EX | LOCK_NB) ) { print $q->h1("Session locked, is running ?"); exit 1; } ... Daemonize like process ... my $pid; open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!"; unless ( defined($pid = fork ) ) { print $q->h1("Can't fork: $!"); exit 1; } if ( $pid ) { # I'm parent... good by to User print "Good Bye,<br>Wait for mail after process..."; exit 1; } #-- dissociate Apache CGI shell unless ( setsid ) { warn "Can't start a new session: $!"; ... mail to user warning failure ... exit 1; } ... do your process ... ... see merlyn's sugestions about sendmail ... flock(F, LOCK_UN ); close(F); exit 1;
--
Marco Antonio
Rio-PM
|
|---|