立石です。
ちょっと暇だったのでhttpdのログをみてみると
なんと??MBにもなっていたのでこんなスクリプト
を書いてみました。
;; SLEEP_TIMEで指定した時間の間隔でLOG_FILES
;; のファイルを時間を付けた形式にrenameして、
;; あらたにファイルを作成し直します。
---------------------------------------------
#!/usr/local/bin/ruby
LOG_FILES = ["test1","test2","test3"]
SLEEP_TIME = 60 * 60
def tail_name
time = Time.new
time.strftime(".%y%m%d.%H%M%S");
end
while TRUE
LOG_FILES.each{|file_name|
if FileTest.exist?(file_name)
File.rename(file_name,file_name+tail_name);
begin
new_file = open(file_name,"w")
ensure
new_file.close
end
end
}
sleep(SLEEP_TIME);
end
------------------------------------------
--------------------------------------------------
Takaaki Tateishi [tateishi / sy.is.noda.sut.ac.jp]
[http://syyk11.is.noda.sut.ac.jp/~tateishi/]
--------------------------------------------------