All:
A vendor provided CGI generates a web page that refreshes itself every 15 seconds or so. They also provide a shell script that is put in the cron to update the data pool as often as you like.

I am guessing the reason that they do not have the page automatically update the data pool itself is because there can only one be one copy of the external shell script running at any one time. The shell script checks to see if it is already running and it aborts if so. This could get complicated if multiple people are viewing the same web page. I know that the vendor COULD have figured out how to handle this, but the bottom line is they didn't.

I would like to change how often the external shell script runs in cron to only once or twice an hour since this web page doesn't get used very much. The problem is, when we do view it - there is the potential the data is a half hour old. My proposed solution is to add a button to the top of the page that says "Update", which would be a hook to call the external shell script - an update on demand if you will.

I know there is still a chance that two people will click the button at the exact same time - but it is reduced dramatically - especially considering we don't use it that often.

Since I am completely CGI illiterate and the vendor says, though I have permission to modify the code, they may choose to update at any time - how do I:

  • Add the button
  • Have it execute the external script
  • Wait until it is finished and then refresh the page
  • Change the code/page as LITTLE as possible

    Waiting for the external script to finish is not absolutely critical since the page refreshes every 15 seconds and it will be updated as soon as the script is finished anyway.

    Any/all help will be appreciated! - L~R


    In reply to CGI Question - run external script and then update page by Limbic~Region

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.