Down for maintenance

Word Count: 260

I know I have seen something similar somewhere else so do not think I am claiming to invent electricity here. We all have applications that need to be updated right? The larger ones usually include some type of code promotion to the production server while the smaller ones are not really thought out. I have a quick way of updating code or a database that I use on smaller sites that are live. When it is time to make a change I simply change my downForMaintenance variable to true. I then set a list of ip's which is usually a list that I would connect from such as work and home. Finally unless the visiting ip address which can be retrieved from the cgi scope is in that list show the visitor a maintenance page while I am still able to view the real thing.

<!--- put this in your appplication.cfm or cfc file --->
<cfset downForMaintenance = true>
<!--- comma delimited list of ip addresses --->
<cfset iplist = "127.0.0.1,192.168.0.1">
<cfif NOT listFind(iplist,cgi.REMOTE_ADDR) AND downForMaintenance>
   <cfinclude template="maintenance.cfm">
   <cfabort>
</cfif>
<html>
<head>
<title>Maintenance Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="100%" height="580" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
   <center>
<img src="mylogo.jpg"><br>
We are sorry but thisapplication.com is currently down for maintenance. Please
Check back in 15 minutes.
</center>
   </td>
</tr>
</table>
</body>
</html>

Comments



Post Your Comment

Leave this field empty







Show Captcha

If you subscribe, any new posts to this thread will be sent to your email address.

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.