in reply to Re: executing other scripts while printing a webpage
in thread executing other scripts while printing a webpage

hmm, well the thing is that script A does not need anything at all from script B to execute. Most of the time, script A wont even call script B, but when it does, it does not have to wait for script B to complete, but it does. I think I need to be more clear.. script A simply prints the webpage, and also checks to see if a certain database file is too old. If that file is old, script A calls script B (currently using server(scriptB.cgi);) which downloads a fresh database file from a remote site (this takes a couple minutes cause its a big file). Script A COULD use the old db file until script B is done, but it doesnt because it waits for the server call to complete.
  • Comment on Re: Re: executing other scripts while printing a webpage

Replies are listed 'Best First'.
Re^3: executing other scripts while printing a webpage
by tadman (Prior) on Jul 30, 2001 at 11:37 UTC
    In that case, don't bother calling script B a ".cgi", since it is really a stand-alone process. CGI programs are intended to be run directly by the client, which means they operate a little differently than regular programs. For instance, using CGI.pm, they require a bit of input from STDIN to get going, unless you specify parameters on the command line.

    How about this:
    if (file_is_too_old()) { unless (fork()) { exec ("update_script"); } }
    Remember that, unless you're using an SUID script, the "update_script" will be run as your Web user, which is traditionally 'nobody'. Make sure that this user has all the required privileges to update your files, or that the SUID user does.