I was wondering a good way to do something...

The last day of every month I have to stay up all night to shut the website down at midnight PST, or one second before, so no new orders make it on the new month until I reset everything...

After I shut down the website for our members, our other programmer has to run some utilities on the databases to make sure they have no errors in them. This can take as little as 2 hours or as much as 6 hours.

So I made a system variable in a database that his system (in PHP) can update when it is done: update pagevars set value = "ready" where name = eom_process

So I want to automate this so I don't have to be right there to do it.

So my question is this.
Could I start my script when it is supposed to, have it shut down the website then do something like this without killing the server memory or resources:
#shut off website... $_sleepTime = (60 * 5); until($dbh->selectrow_array(qq{select `value` from `pagevars` where `n +ame` = "eom_process"}) eq "ready") { sleep($_sleepTime); } # once ready then it will continue the functions until completed then +turn the website back on
I have not really utilized sleep before so I'm not sure if it would work properly.

Do you know if that would kill the system memory or create anything else to go wrong?

Or do you know a better way to do it?

Thanks,
Richard


In reply to automating a task by Anonymous Monk

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.