View Full Version : index.html inaccesible when updating that file?
EnAlgures 01-06-2006, 08:45 PM I'm developing a index from my website which is going to be updated automatically by a perl script executed by the cron job manager from cPanel every 30 minutes.
I don't know which is the best way to do it. I'm wordering about two different options, update the index.html by the perl script or use a index.pl which takes the data from a mysql database.
I believe that the index.html way is the best option but there is a critical point: When the perl script updates the index.html file it's going to be inaccesible index.html?
NateD 01-07-2006, 05:33 AM From my experience, the index.html will be inacessible for the quick second or so that it's being overwritten so I don't think that's too much of a problem. Most visitors will push refresh to try again and then your index.html page will appear.
You also get the added benefit of it being a cached copy of your data so there will be less load on your DB server.
EnAlgures 01-07-2006, 10:36 AM Thanks,
In that case the index would be inaccesible 1440 times per month. I would loose money.
any other opinion?
ThatScriptGuy 01-07-2006, 01:07 PM Make it index.php (or pl) and pull the info from the database. Only suggestion I can come up with.
NateD 01-07-2006, 09:32 PM Thinking about it further, unless its a really massive output that's being written to index.html I'm questioning whether it would take a full second to write.
Unless you are getting thousands upon thousands of hits each hour is unlikely that any of your users are going to hit the index.html page the instant it is being overwritten. Maybe setup an email link so if a large proportion of users are hitting the page when its being rewritten, use kvnband's suggestion above.
rrdega 01-08-2006, 07:53 AM Hmmmmm....
* Move index.dat to index.old.dat
* In index.html {or .pl, or whatnot} check if index.dat exists
-- If exists, load page from index.dat
-- Else, load page from index.old.dat
* Have routine create index.new.dat
* Upon completion of creation, move index.new.dat to index.dat
Would that do it? {Properly coded in your language of choice, of course...}
EnAlgures 01-08-2006, 11:57 AM Hmmmmm....
* Move index.dat to index.old.dat
* In index.html {or .pl, or whatnot} check if index.dat exists
-- If exists, load page from index.dat
-- Else, load page from index.old.dat
* Have routine create index.new.dat
* Upon completion of creation, move index.new.dat to index.dat
Would that do it? {Properly coded in your language of choice, of course...}To do that index.html need to be interactive, not an static index.html. Therefore it would be the same problem than using index.pl (cgi).
vasam 01-09-2006, 09:04 AM I can suggest following:
- create index.php and index.html files
- index.php will always retrieve data from your database and your website will not experience downtime while generating static html file.
EnAlgures 01-09-2006, 01:14 PM I can suggest following:
- create index.php and index.html files
- index.php will always retrieve data from your database and your website will not experience downtime while generating static html file.I don't understand you
vasam 01-09-2006, 01:18 PM index.php should be connected to your database, and retrieve data from there..
and your visitors will not notice any downtime while you generate your primary (index.html) file.
EnAlgures 01-09-2006, 01:23 PM But how it's going to work that? I mean, index.php it's not going to be showed never if index.html exist.
ThatScriptGuy 01-09-2006, 01:35 PM I'm afraid i still don't understand why you can't pull information straight from the database. Although the chances that a visitor would catch a half updated index page are slim, making a dynamic page would eliminate those risks altogether.
Kevin
EnAlgures 01-09-2006, 01:51 PM It wouldn't be the first time mysql server stop working.
Anyway, by the moment, I'll use index.pl with mysql
|