Godaddy cron job 的执行时间最大是36秒

想想也是,这种相对来说比较便宜的共享空间,也不会让你占用太多的系统资源。
刚写了一个死循环的脚本,跑了一下,得出的时间是36妙。

#!/usr/local/bin/ruby
# index.cgi
require "time"

i=0
tm = Time.now
newfile = File.open( "time1.html", "w+",0644)
newfile << tm.min().to_s + ":" + tm.sec().to_s + "\n"
newfile.close

while true
  i=i+1
  if i % 1000000 == 0 then
    tm = Time.now
    newfile = File.open("time2.html", "w+",0644)
    newfile << tm.min().to_s + ":" + tm.sec().to_s + "\n"
    newfile.close
  end

end

time1.html和time2.html的时间相差了36妙。
有个老外也碰到了这个问题。
http://bogdan.org.u......html
不光跑ruby有这个问题,跑python,ELF等也有这个问题。

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>