[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Get cgi script to begin execution of another script...

sophie

3/12/2008 4:44:00 PM

I've posted something similar to this already, but now I'm more sure
of what I'm asking.

Basically I've a CGI script, that when executed by the user, I want to
call another script that does a very long running task (10 hours +)
and print a message on the screen saying that the user will be emailed
on completion of the very long task. The script executing the very
long task will then email the user on completion.

So far I have something like this (leaving out the obvious)...

CGI script:

pid = subprocess.Popen(["python", "spawn.py"]).pid
print "Thanks you will be emailed on completion"


Spawn.py script:

doVeryLongCalc()
emailUser()


Basically the problem with this is that the cgi script page in the
browser keeps on acting as if its loading until the Spawn.py script is
finished executing. Somehow apache "knows" that the spawned process is
still running in the background. So I'm basically asking if I can
somehow spawn a script that will be completely independent of its
parent script? So Apache doesn't know its running and the page
finishes loading?

Thanks if anyone can help...
1 Answer

Sion Arrowsmith

3/13/2008 2:52:00 PM

0

sophie_newbie <paulgeeleher@gmail.com> wrote:
>Basically I've a CGI script, that when executed by the user, I want to
>call another script that does a very long running task (10 hours +)
>and print a message on the screen saying that the user will be emailed
>on completion of the very long task. The script executing the very
>long task will then email the user on completion.

http://aspn.activestate.com/ASPN/Cookbook/Python/Rec...
was helpful to me in solving this problem.

--
\S -- siona@chiark.greenend.org.uk -- http://www.chaos.org...
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump