#!/usr/bin/perl # アンテナ kick cgi # 更新間隔(sec) 3600秒=1時間 $span =1800; # 表示する巡回アンテナの結果ファイルを指定 $file = "/home/dunharro/public_html/herowars/link2.html"; #巡回アンテナの結果ファイルの前回更新時刻を取得 #$mtimeが最終更新 ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime) = stat($file); $modified = gmtime($mtime); # refererを知る $ref = $ENV{'HTTP_REFERER'}; #現在時刻を取得 $tt = time; # 巡回アンテナの結果ファイルを画面出力 print "Content-type: text/html\n"; print "Last-modified: $modified GMT\n"; print "\n"; # 画面出力処理起動 &printhtml; # 前回更新時間と現在時刻との比較を行い、更新間隔を越えていたらアンテナを起動 if ($tt - $mtime > $span) { # 更新時間経過 exec("sh /home/dunharro/public_html/cgi_bin/wdb/elnor_dance.sh"); } #処理終了 #---------------------------------------------------------------------# # サブルーチン #---------------------------------------------------------------------# # 巡回アンテナの結果ファイルの画面出力処理 sub printhtml { open(FILE, $file); while($tmp = ) { print "$tmp\n"; } close(FILE); } 1;