axl163 has asked for the wisdom of the Perl Monks concerning the following question:
browser->request->cgi->execute another program | return submitted successful message and close connection without waiting for the other process
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: $!"; my $pid = fork(); if (not defined $pid) { print "resources not available.\n"; } elsif ($pid == 0) { #this is where I launch the other executable system("/usr/local/bin/launch myfile &") or die("Cannot execute la +unch: $!\n"); exit; } else { setsid or die "Can't start a new session: $!"; open STDERR, '>&STDOUT' or die "Can't dup stdout: $!"; #this is the return message print "Your file has been sent successfully. You will be notified + via email once it has been completed. Thank you."; print end_html(); exit; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Fork() and exec()
by graff (Chancellor) on Oct 27, 2007 at 00:27 UTC | |
Re: Fork() and exec()
by runrig (Abbot) on Oct 26, 2007 at 23:01 UTC | |
Re: Fork() and exec()
by tuxz0r (Pilgrim) on Oct 27, 2007 at 00:39 UTC | |
Re: Fork() and exec()
by axl163 (Scribe) on Oct 27, 2007 at 00:57 UTC | |
Re: Fork() and exec()
by axl163 (Scribe) on Oct 27, 2007 at 01:00 UTC | |
Re: Fork() and exec()
by neversaint (Deacon) on Oct 27, 2007 at 14:48 UTC |