Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

(joealba) 1 hour cgi script?

by joealba (Hermit)
on Nov 27, 2001 at 19:14 UTC ( [id://127803]=note: print w/replies, xml ) Need Help??


in reply to Re: (crazyinsomniac) Re: Detect Stop Button
in thread Detect Stop Button

Reply from thread below: My script runs for about 1 hr so I had set my Apache TimeOut variable to a huge value (3600). This seems to work for most browsers. I think I'll try your idea of printing blank chars to STDOUT instead. The TimeOut variable effects all requests and probably leaves me with lots of Apache children hanging around

Okay, so let me make sure I'm clear on this. You have a CGI script which runs for almost one hour. This cgi script creates a number of static html files to represent results from MySQL searches? Is the user expected to hang around for an hour to view the resulting html pages?

It sounds like you *really* should be taking in the form information, verifying that you have all the form data, then writing this form data to a file. Then, a cron script should run every so often to see if any form data files exist, and process them accordingly. Then, the cron script could send the user an e-mail upon completion.

By verifying your form data way before the script even runs, you will save those times where someone says "Oh shoot, I mistyped this field.. let me go back." You also can more appropriately schedule the running of this one hour script to not choke up your system.

Besides, I can't think of ANY reason that a cgi script should run for longer than 5 minutes or so, and even that is quite silly. No one is going to watch the output for a whole hour, so you might as well e-mail them when it's done.

Replies are listed 'Best First'.
Re: (joealba) 1 hour cgi script?
by kwoff (Friar) on Nov 28, 2001 at 05:16 UTC
    I think you're making too many assumptions about the user. If it's an "in house" type of "admin tool", it could be some kind of reporting tool so that a manager doesn't have to know how to make MySQL queries. For example, maybe they only need the information on demand about every other month, so it would be wasteful to have a cron job doing an hour of processing every day. You might think just run a command, but some people don't have any idea what that really means, and developers get tired of being command-line (and MySQL :) monkeys.
      Well, cron jobs can run at any interval.. once a minute, once an hour, once a month... You just make the best choice for the application.

      There is still no good reason for a CGI script to run for 1 hour. Leaving a browser window tied up for that long is a Bad Idea, especially when a browser timeout will stop this lengthy report from running.

      The process could maybe be started through a CGI script, forked off, and then e-mail the user when it is complete. But, it shouldn't sit there running.

      TMTOWTDI, but a 1 hour CGI script is the wrong way.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found