Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 12:42 am EST

Geeklog Forums

GL Site Downtime Hack


Status: offline

racooper

Forum User
Junior
Registered: 03/13/04
Posts: 24
I run several sites as apache vhosts on one server. Unfortunately, the backend database server (on a different machine) died hard earlier today. While I will get it back up and recovered, I discovered, much to my chagrin, that I would have to edit config.php on every site to turn on and off the downtime message. I came up with a more elegant solution (*I* think):

At the top of index.php, immediately after the header but before the "require" statement, I added the following code:
Text Formatted Code

// Hack to bounce if downtime.html exists
if (file_exists('/path/to/primary/site/public_html/downtime.html'))
    {
    header("Location: http://primarysite.com/downtime.html");
    exit;
    }

 

At least in my case, that makes it possible to add and change one file (downtime.html) in my primary site, and the rest will determine on their own to be up or down. When the db server comes back up, all I have to do is remove or rename downtime.html to restore all the sites. I also added this to the index.php of the one PostNuke site I host as well, and it works flawlessly.
 Quote

Status: offline

casper

Forum User
Full Member
Registered: 02/11/04
Posts: 142
Location:Skien, Norway
Nice.. Something that a newbie like me would ever think of...
I run five sites with GL, and this ones smart Wink

I only changed one thing, I added the hack to lib-common, that way every funktion on the site gets disabled.
Thats especially important if you do some work on a database.
 Quote

All times are EST. The time is now 12:42 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content