Running Perl scripts on background from Web 
Author Message
 Running Perl scripts on background from Web

Hi,

I need to launch a perl script from an HTML page.
Since there, no problem.
But I want this script to be launched on background.

I think the equivalent command in shell would be :
nohup script_name >| /tmp/nohup.out &

I tried to run this from a CGI Perl Script using exec and found that
exec waits for the command to terminate.

So I tried to launch it the same way but from a manually forked process
using :

if ($pid=fork){
#Father
print "Content-type: text/html\n\n\n";
# HTML content

Quote:
}

else{
autoflush;
exec("nohup script >| /tmp/nohup.out &");

Quote:
}

Curiously, it seems that Netscape server waits for all processes to
terminates (father and sonn).

Someone an idea ?



Fri, 16 Feb 2001 03:00:00 GMT  
 Running Perl scripts on background from Web

Quote:

> Hi,

> I need to launch a perl script from an HTML page.
> Since there, no problem.
> But I want this script to be launched on background.

> I think the equivalent command in shell would be :
> nohup script_name >| /tmp/nohup.out &

> I tried to run this from a CGI Perl Script using exec and found that
> exec waits for the command to terminate.

> So I tried to launch it the same way but from a manually forked process
> using :

> if ($pid=fork){
> #Father
> print "Content-type: text/html\n\n\n";
> # HTML content
> }
> else{
> autoflush;
> exec("nohup script >| /tmp/nohup.out &");
> }

> Curiously, it seems that Netscape server waits for all processes to
> terminates (father and sonn).

> Someone an idea ?

:]

Yes.  Be smarter than your machine and have the calling CGI
e-mail the script you want to run in the background :]

I have found a universe beyond CGI ... it's wonders are magic.

HTH,
-Sneex-
__________________________________________________________________
Bill Jones | FCCJ Webmaster | Murphy's Law of Research:
           Enough research will tend to support your theory.



Fri, 16 Feb 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Run a script from a web browser and put it in the background

2. Running a program in the background on a NT web server

3. Perl Script hang when run in background

4. Perl Script hang when run in background

5. Running perl scripts in the background

6. Running a perl script in the background on Windows(95/NT)

7. run perl script in background when html loads, without user intervention

8. Calling another perl script to run in the background

9. perl script for calling a java program,running the script through cgi of the web server

10. Running ActiveState scripts fully in background on NT

11. Running script as background program.

12. problem: running a background process from cgi-script??

 

 
Powered by phpBB® Forum Software