Welcome to bytea
当前位置: Home 本站工具集 今天是...date...

登录bbs

用户名
密码

bytea统计

Members : 43193
Content : 332
Web Links : 69
更新itnews栏目 PDF Print E-mail
Thursday, 25 January 2007 08:00
升级了lilina到0.7,更改了html缓存方式,以前那种内嵌网页的方式总觉得怪怪的,这次采用的方法是wget。具体来说就是用crontab设置每小时运行一次以下shell scrpit:

wget -q -O index2.html http://www.bytea.net/itnews/index.php
difference=`diff -q index.html index2.html`
if test "$difference"
then
mv index2.html index.html
fi

解释一下:第一行是用wget从php获取html输出,-q是quiet,因为我不想运行crontab的时候产生一大堆的output。 第二行比较新生成的index2.html和现有的index.html,下面几行是判断如果有更新,就替换。很简单很有效的html缓存方法,不过需要有shell。
还有一点要说明,运行crontab时文件名都要使用绝对路径,上面的代码安全起见我把绝对路径删了。
Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security code
Write the displayed characters


busy
 

支持本站:


Connect with me via QQ:38074 or e-mail:

©2006 bytea.net All Copyrights Reserved.

本站备案编号:保密^_^

RSS:  

开启背景音乐