in reply to Keep track of running CGI script

Hi. Me again. I am currently forking a process like you suggested, but what I want to do is determine the progress of the script by tracking the number of records it has inserted. So I want the "Please be patient" file to display:


45896 of 296390 records inserted


I do not know of a simple way to do this when I fork a child process to do the work. The only thing I thought of was to have the child write the current record to a temporary file at some interval and have the "Please be patient" file read the latest record and display it. I was hoping there was an easier way to do it.

Thanks for the responses,

-jim

Replies are listed 'Best First'.
Re: Re: Keep track of running CGI script
by Anonymous Monk on Oct 18, 2001 at 23:09 UTC
    I like the suggestion by clive, but I'd modify it slightly. You've got a database so why not get the result from that. Have a cgi script with 2 params, total and begin, total has the number of records we are going to put in the table and begin is how many there was before we started.

    /status.cgi?total=296390&begin=245

    select count(*) from table

    printf "%d of %d records inserted", $count - param('begin'), param('total');

    -- Gavin