[Javascript] Time & day-based redirects?

David T. Lovering dlovering at gazos.com
Sat Mar 29 11:36:27 CST 2003


One way of dodging this headache is to build a PHP (or similar) front-end
call that checks to see if SQL server-A is up, and if not, connect to server-B
for its queries.  Presuming that server-A and server-B have mirrored data,
this would hide all the nastiness from the user altogether.  Since PHP code
would run on the server, physically shutting down the server would be bad,
but physically shutting down SQL (on Server-A) would not be so bad.

If you want one more level of robustness, use a load-balancer or a router
that can redirect traffic in a given protocol from one server to another
on the fly, so that when server-A is going down, it can request that the
HTTP/HTTPS traffic be redirected to server-B, and vice-versa.

We do this all the time.

-- Dave Lovering

"McCoy, Thomas" wrote:
> 
> This issue truly is larger than I thought!  I'm still pouring through all
> the e-mails, and I sincerely thank everyone here for their top-level logic
> :)
> 
> You are correct in saying that the server is not "down".  The server houses
> an on-line catalog program/service  (allowing customers to search for books
> within a library) which stops itself during backup (has to disconnect from a
> Sybase SQL server - rendering catalog searching useless).
> 
> Currently, library customers see an error.  I could be wrong, but I believe
> the Web connection remains during this lack of catalog service... so
> theoretically I could have a script on the server that takes over, but I
> will continue to explore all options.
> 
> Whew!
> 
> 
> Sincerely,
> Thomas McCoy
> 
> 
> 
> -----Original Message-----
> From: Terry [mailto:bader at tcbader.com]
> Sent: Wednesday, March 26, 2003 1:23 PM
> To: [JavaScript List]
> Subject: Re: [Javascript] Time & day-based redirects?
> 
> for "Backup Reasons"  which does not mean the server is down...  you just
> want to reduce the number of files accessed...  thus this would be an ideal
> solution...  just inside your server-side script you redirect all requests
> to a single page...  so only 2 files would be in use during that time... and
> who cares if they get backed up, they should be on your dev server; the
> server side script and the display page, if they are not one in the same...
> 
> ~ Terry
> 757 581-5981
> AIM/Yahoo: lv2bounce
> 
> ----- Original Message -----
> From: "Michael Dougherty" <Michael_Dougherty at PBP.com>
> To: <javascript at LaTech.edu>
> Sent: Wednesday, March 26, 2003 4:18 PM
> Subject: RE: [Javascript] Time & day-based redirects?
> 
> > ...because if the server is down, there will be no way for that message to
> > be calculated...
> >
> >   In the same way it's not very useful for your email administrator to
> email
> > you that email services are not working... <g>
> >
> >   If the "Server" under maintenance is a _database_ server, and the _web_
> > server remains functional, then you're right - that code can run smoothly
> on
> > the web server while the database server is under maintenance.
> >
> >   If you have a NAT firewall/router between the user and the web server,
> you
> > could redirect the traffic to an entirely different web server - but
> unless
> > you can automate that process, it's pretty likely that the process won't
> be
> > done reliably.
> >
> > -----Original Message-----
> > From: javascript at LaTech.edu [mailto:javascript at LaTech.edu]
> > Sent: Wednesday, March 26, 2003 2:55 PM
> > To: javascript at latech.edu
> > Subject: Re: [Javascript] Time & day-based redirects?
> >
> >
> > well, if you are running a large site then you are using a server side
> > language more then likely or even Server Side JS.  Why not just do
> > something
> > like:
> >
> > IF dayofweek(now()) = Monday and 0200 < now() > 0700 THEN
> > {
> >     print "
> >     <SCRIPT>
> >         alert('Site is down for maintanence');
> >     </SCRIPT>
> >     "
> > }
> >
> >
> > Or even better yet, like i do.  I have a table in our db for all the
> > default
> > settings of the website.  In there i have:
> > Columns: main_siteDown, main_siteDownMsg
> > Values: 0, "Site is down for maintenance"
> >
> > And then from a web page that we only have access too, I can change the
> msg
> > to whatever and set the main_siteDown to 2.  All accounts are locked out
> > except Admins.  Setting it to 1, displays the msg, usually saying "The
> > system is going down at whatever time" without locking ppl out.
> >
> > But your time needs to originate Server Side since that is what is under
> > maintanence.
> >
> > ~ Terry
> > 757 581-5981
> > AIM/Yahoo: lv2bounce
> >
> >
> > ----- Original Message -----
> > From: "Chris Tifer" <christ at saeweb.com>
> > To: "[JavaScript List]" <javascript at LaTech.edu>
> > Sent: Wednesday, March 26, 2003 3:14 PM
> > Subject: Re: [Javascript] Time & day-based redirects?
> >
> >
> > >> I'm fully aware of this. I was showing him why it's even more of a
> > >problem
> > >> than he thought.  I know, this e-mail did not solve his problem
> > >either...
> > >>
> > >> ----- Original Message -----
> > >> From: "BEKIM BACAJ" <trojani2000 at hotmail.com>
> > >> To: <javascript at LaTech.edu>
> > >> Sent: Wednesday, March 26, 2003 2:44 PM
> > >> Subject: Re: [Javascript] Time & day-based redirects?
> > >>
> > >>
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >
> > >> > I guess I'll have to agree with you; -But this doesn't solve the
> guy's
> > >> > problem.
> > >> >  >From: "Chris Tifer" <christ at saeweb.com>
> > >> > >Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
> > >> > >To: "[JavaScript List]" <javascript at LaTech.edu>
> > >> > >Subject: Re: [Javascript] Time & day-based redirects?
> > >> > >Date: Mon, 24 Mar 2003 15:57:08 -0500
> > >> > >
> > >> > >That's assuming the user's local time is even correct, too.  I could
> > >> change
> > >> > >my
> > >> > >PC's time with no problem and when I was using my PC for
> > >time-sensitive
> > >> > >purposes sometimes, I would do that routinely, so my time was never
> > >> > >correct.
> > >> > >
> > >> > >Chris Tifer
> > >> > >
> > >> > >----- Original Message -----
> > >> > >From: "BEKIM BACAJ" <trojani2000 at hotmail.com>
> > >> > >To: <javascript at LaTech.edu>
> > >> > >Sent: Monday, March 24, 2003 3:49 PM
> > >> > >Subject: RE: [Javascript] Time & day-based redirects?
> > >> > >
> > >> > >
> > >> > > > I'll have to add that the user local time should not be that much
> > >of
> > a
> > >> > > > problem.
> > >> > > > I've written this {Mon Mar 24 21:26:24 UTC+0100 2003
> > >> > > > } with:
> > >> > > > var date=new Date()
> > >> > > > document.write(date)
> > >> > > >
> > >> > > > The point is "UTC+0100", it shows the time offset, so one can
> > >> calculate
> > >> > >it.
> > >> > > > Win media and Real Player etc use UTC with script routine for
> > >> > >calculation
> > >> > > > and delivery of content at exact time of the day to their clients
> > for
> > >> > >almost
> > >> > > > a decade.
> > >> > > > Regards!
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > >From: "Walter Torres" <walter at torres.ws>
> > >> > > > >Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
> > >> > > > >To: "[JavaScript List]" <javascript at LaTech.edu>
> > >> > > > >Subject: RE: [Javascript] Time & day-based redirects?
> > >> > > > >Date: Mon, 24 Mar 2003 12:35:49 -0600
> > >> > > > >
> > >> > > > >Well, the best way to handle this is to have a small web server
> > that
> > >> > >takes
> > >> > > > >over between 2 and 7.
> > >> > > > >
> > >> > > > >This is the only way to gaurenty the user gets what you want
> them
> > to
> > >> > >get.
> > >> > > > >
> > >> > > > >After all, client side JS uses the clients machine time, so you
> > can't
> > >> > > > >control that, it (most likely) will be in a different time zone,
> > and
> > >> it
> > >> > >may
> > >> > > > >be *wrong*!
> > >> > > > >
> > >> > > > >You can use ASP/PHP because your server is down from 2 to 7,
> then
> > >> > >ASP/PHP
> > >> > > > >needs a server to operate.
> > >> > > > >
> > >> > > > >So, second server givng a single page that tells the user waht
> > >you
> > >> want
> > >> > >to
> > >> > > > >tell them.
> > >> > > > >
> > >> > > > >Walter
> > >> > > > >
> > >> > > > >
> > >> > > > >  -----Original Message-----
> > >> > > > >From: javascript-bounces at LaTech.edu
> > >> > > > >[mailto:javascript-bounces at LaTech.edu]On
> > >> > > > >Behalf Of McCoy, Thomas
> > >> > > > >Sent: Monday, March 24, 2003 12:07 PM
> > >> > > > >To: '[JavaScript List]'
> > >> > > > >Subject: RE: [Javascript] Time & day-based redirects?
> > >> > > > >
> > >> > > > >
> > >> > > > >   Apparently my logic is "down" Monday mornings, too :)   Sorry
> > guys
> > >> &
> > >> > > > >gals!
> > >> > > > >
> > >> > > > >     -----Original Message-----
> > >> > > > >     From: Chris Tifer [mailto:christ at saeweb.com]
> > >> > > > >     Sent: Monday, March 24, 2003 10:04 AM
> > >> > > > >     To: [JavaScript List]
> > >> > > > >     Subject: Re: [Javascript] Time & day-based redirects?
> > >> > > > >
> > >> > > > >
> > >> > > > >     And also the fact that if the page truly cannot be found, I
> > >> don't
> > >> > > > >believe
> > >> > > > >     you're going to have much luck sending something to the
> > >client
> > >> > >since,
> > >> > > > >well,
> > >> > > > >     the server's down.
> > >> > > > >
> > >> > > > >     Chris Tifer
> > >> > > > >     http://emailajoke.com
> > >> > > > >
> > >> > > > >       ----- Original Message -----
> > >> > > > >       From: Jaime Iniesta
> > >> > > > >       To: '[JavaScript List]'
> > >> > > > >       Sent: Monday, March 24, 2003 12:56 PM
> > >> > > > >       Subject: RE: [Javascript] Time & day-based redirects?
> > >> > > > >
> > >> > > > >
> > >> > > > >       That should be better done with a server-side script
> > language
> > >> > >like
> > >> > > > >ASP
> > >> > > > >or PHP, because with Javascript you will be checking the time on
> > the
> > >> > >client
> > >> > > > >side, and because when your server is at 2AM - 7AM, visitors
> from
> > all
> > >> > >over
> > >> > > > >the world will be on different times...
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >       Jaime
> > >> > > > >
> > >> > > > >       jaime at alazan.com
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >       -----Mensaje original-----
> > >> > > > >       De: javascript-bounces at LaTech.edu
> > >> > > > >[mailto:javascript-bounces at LaTech.edu] En nombre de McCoy,
> Thomas
> > >> > > > >       Enviado el: lunes, 24 de marzo de 2003 18:47
> > >> > > > >       Para: 'javascript at LaTech.edu'
> > >> > > > >       Asunto: [Javascript] Time & day-based redirects?
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >       Every Monday morning between 2AM and 7AM our server goes
> > down
> > >> > >(for
> > >> > > > >backup reasons).  Does anyone know of a JS script (or another
> > >> language
> > >> > >if
> > >> > > > >necessary) that would redirect based upon day and time?  This
> way
> > the
> > >> > > > >temperamental user would see a "we'll be back at 7AM" screen,
> > instead
> > >> > >of
> > >> > > > >"page cannot be displayed" and then they freak out and start
> > >> dissecting
> > >> > > > >their PC :)
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >       Thanks in advance for your help!
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >       Sincerely,
> > >> > > > >       Thomas McCoy
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >>
> >
> >>--------------------------------------------------------------------------
> > >> > > > >
> > >> > > > >
> > >> > > > >       _______________________________________________
> > >> > > > >       Javascript mailing list
> > >> > > > >       Javascript at LaTech.edu
> > >> > > > >       https://lists.LaTech.edu/mailman/listinfo/javascript
> > >> > > > >_______________________________________________
> > >> > > > >Javascript mailing list
> > >> > > > >Javascript at LaTech.edu
> > >> > > > >https://lists.LaTech.edu/mailman/listinfo/javascript
> > >> > > >
> > >> > > > _________________________________________________________________
> > >> > > > Add photos to your messages with MSN 8. Get 2 months FREE*.
> > >> > > > http://join.msn.com/?page=features/featuredemail
> > >> > > >
> > >> > > > _______________________________________________
> > >> > > > Javascript mailing list
> > >> > > > Javascript at LaTech.edu
> > >> > > > https://lists.LaTech.edu/mailman/listinfo/javascript
> > >> > >
> > >> > >_______________________________________________
> > >> > >Javascript mailing list
> > >> > >Javascript at LaTech.edu
> > >> > >https://lists.LaTech.edu/mailman/listinfo/javascript
> > >> >
> > >> >
> > >> > _________________________________________________________________
> > >> > Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> > >> > http://join.msn.com/?page=features/featuredemail
> > >> >
> > >> > _______________________________________________
> > >> > Javascript mailing list
> > >> > Javascript at LaTech.edu
> > >> > https://lists.LaTech.edu/mailman/listinfo/javascript
> > >> >
> > >>
> > >> _______________________________________________
> > >> Javascript mailing list
> > >> Javascript at LaTech.edu
> > >> https://lists.LaTech.edu/mailman/listinfo/javascript
> > >>
> >
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript


More information about the Javascript mailing list