I am looking for a script that is simple and will automatically display a message if my site is experiencing a server overload, say basically if a page wont load for longer than 30 seconds it will say that automatically
I am looking for a script that is simple and will automatically display a message if my site is experiencing a server overload, say basically if a page wont load for longer than 30 seconds it will say that automatically
Need help with starting up your website? No problemo PM if you need help, if you want help with scripts like WordPress, SMF and so on dont be afraid to PM for that too.
I think this will work:
I would consider using a value significantly less than 30. Maybe 5-10 seconds. Most users won't wait 30 seconds for a page to load, browsers will stop trying after too long, and the server will kill the script if it takes too long.. If the server doesn't output enough of the page, this script will also fail. The only time it will work is if you have a server side script that takes too long, either due to server load or the script taking too long.Code:<html> <head> <script type="text/javascript> var t = setTimeout("timeout()", 30000); // function timeout() will be called after 30000ms (30s) function timeout() { var node = document.createTextNode("This is your error message"); document.getElementById("error").appendNode(node); } </script> </head> <body> <p id="error"></p> <!-- other stuff will be happening here. Hopefully it will time out here and not sooner :) --> <script type="text/javascript"> clearTimeout(t); // cancel the error script </script> </body> </html>
gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer
Wow!
As usual, garrettroyce doesn't just answer questions for people, he completely obliterates the question. Even producing all the coding isn't too much trouble for him. Nice.
I'm tempted to ask him to solve the Meaning of Life for me, when he's got a spare minute. ;)
For great installation & servicing of Audio Visual systems & equipmentinc. LCD & Plasma Screens, Loudspeakers, Projectors, Aerials & Satellite Dishes, Lighting effects & controllers, Hifi, Amplifiers, Surround Sound, Home Cinema & Video etc-: based around Plymouth, Devon, or anywhere in the southwest of the UK, visit :-
42.
Now, you just need the question (any Hitchhiker's guide to the galaxy fans?)
I've been thinking some more about your problem. My guess is you want to have something if X10 is having problems, not because your site is running some really really massive program. In that case, I think you would be better using multiple hosts and providing the nameservers of both hosts to your domain registrar.
I'll walk you through this process if I'm right ;)
gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer
(Hehe. See ; http://forums.x10hosting.com/crossfi...tml#post533406 )
For great installation & servicing of Audio Visual systems & equipmentinc. LCD & Plasma Screens, Loudspeakers, Projectors, Aerials & Satellite Dishes, Lighting effects & controllers, Hifi, Amplifiers, Surround Sound, Home Cinema & Video etc-: based around Plymouth, Devon, or anywhere in the southwest of the UK, visit :-
Can you elaborate on your idea? I think im following you but not sure...
And serisoly, if you dont have the answer no one does, what is the meaning of life
Need help with starting up your website? No problemo PM if you need help, if you want help with scripts like WordPress, SMF and so on dont be afraid to PM for that too.
The idea is, if your page starts to load then stops for a long time, an error message will pop up. This will not work, however, if the server is so overloaded and the connection times out. The only time it will probably work is if your script takes too long to execute.
What you can do is have another hosting account at another free host and use both at the same time to display your site. So, if one goes down, the other will still work. However, if you do this, then you have to keep them up to date with each other. If you have a forum, this becomes impossible; just go to paid ;)
gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer
lol, i see the problems with it and they look like they wont allow me to do that, awesome as the idea is. Could i have it redirect to a link of my chosing if the server were to time out or is that not possible?
BTW I would really love your help in developing my MMORPG
Last edited by taha116; 06-11-2009 at 08:33 PM.
Need help with starting up your website? No problemo PM if you need help, if you want help with scripts like WordPress, SMF and so on dont be afraid to PM for that too.
Instead of outputting text to the browser, you could redirect. But, I think you will have the same problems as before. The primary problem for pages is the server does not output anything, not the server only outputting half a page.
I'd be happy to help you with your mmorpg, just as soon as I'm done with my own project ;)
gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer
Ok how long would that project take?
Im bracing myself for a very far away date
Last edited by taha116; 06-11-2009 at 10:35 PM.
Need help with starting up your website? No problemo PM if you need help, if you want help with scripts like WordPress, SMF and so on dont be afraid to PM for that too.