Re: [PHPLIB] Sneaky Use of prepend.php3 From: jim kraai (jkraai <email protected>)
Date: 11/24/99

Bob,

What we do is like this:

In the shell script that gets invoked by cron:
        touch /tmp/site-name.down
        # Do maintenance functions
        # Do maintenance functions
        # Do maintenance functions
        rm -f /tmp/site-name.down

So, while the maintenance is running, a zero-byte file of a known
name and in a known location exists. When maintenance is done,
it's gone.

The prepended file begins with:
        <?php
        if (is_file('/tmp/site-name.down')) {
                include "down.php3";
                exit;
        );
        # Continue processing if not down

So, if prepended file is invoked and finds the site-name.down file,
then it includes "down.php3" and does a hard exit:

In down.php3
        Nice message, please come back real soon!

--jim

Bob Bowker wrote:
>
> Hi --
>
> We use a cronjob for automatic database maintenance every Tuesday at
> 1:00am, and we'd like to "shut down" the site while the MySQL engine does
> its stuff. Our problem is that many people arrive with bookmarks to pages
> deeper within the site, therefore bypassing any simple index.html "cut-out".
>
> Is there any reason we can't replace prepend.php3 with a script (by the
> same name) which shows a "down for maintenance" page to ALL visitors, then
> renames the proper prepend.php3 code when it's done?
>
> We've played with this a bit, but the cronjob that runs nicely without the
> rename/work/rename hangs up quite badly with it ...
>
> Once the proper prepend.php3 has been added to the cronjob script, can the
> actual prepend.php3 file be replaced temporarily? ... or are there
> problems with this scenario?
>
> Any better ideas on how to "shut down" the site ...?
>
> Thanks --
>
> Bob Bowker
> bowker <email protected>
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.