Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: system or exec in a web environment

by paulbort (Hermit)
on Jun 09, 2004 at 13:58 UTC ( [id://362729]=note: print w/replies, xml ) Need Help??


in reply to system or exec in a web environment

The other monks are correct, 'exec' never returns. Never.

I would suggest changing the CGI script to give the user a message like "Your file is being processed" and just end.

Then in the background, you need a listener program that watches that directory for new files, picks them up in turn, and processes them. The one I wrote is a shell-script that runs a Perl script every 10 seconds, and is started by rc.local. If you want it to process multiple files at a time, a thread pool can be your friend.

If you need to keep users informed about how their files are going, a CGI script that displays results from a status table, updated by the worker threads, might make sense. (You could even make it part of the original script with a refresh, if you want that 'interactive application' style.)

--
Spring: Forces, Coiled Again!
  • Comment on Re: system or exec in a web environment

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://362729]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 17:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found