Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Suppose I have a CGI script running on a public webserver. This script consists of a top-level script and multiple perl module source files. From time to time I improve the script and then I install new versions of all the files. I'd like to make sure that no running instance of the script can see an inconsistent state of the install if it's running at the same time as I'm doing the install.

Currently my install command just copies all the files to the place where they're used from. This means that the CGI script could be started before the install, but load a module later, after the install. This and other races are what I'd like to stop.

I don't care if I have to temporarily make the webpage unavailable for a short period during the install, that is, if a user tries to use the CGI during such an unfortunate time, it's okay if they get a 403 error or a broken connection. It's also okay if the install has to wait for a short time until all already started instances of the CGI exit. It is not okay however to have to stop the whole Apache webserver for the installation (the webserver serves webpages other than this CGI), reboot the machine, or otherwise break some functionality on the host.

I'd like to know if there's an existing good practice to solve this. If there isn't, I can probably invent some new solution, but that would probably be ugly.

In reply to Install updated version of script such that running instances cannot use an inconsistent state by ambrus

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (4)
    As of 2018-04-27 06:58 GMT
    Find Nodes?
      Voting Booth?