#!/usr/local/bin/perl

$blogid = @ARGV[0];

# 最終アクセス時間を外部ファイルから取得しています
open HN, "mt-period.txt";
$lasttime = <HN>;
$nowtime  = time;
close HN;

# 最終アクセス時刻から30分経過したかどうかチェックしています
if ( $nowtime - $lasttime >= 1800 )
{
# ここで指定インデックス・テンプレートの再構築を行っています
# system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='メインページ'");

system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='Main Index'");
system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='2nn'");
system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='ITmediaNewsWeb20'");
system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='gontdo2'");
system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='kizasi'");
system("perl mt-rebuild.pl -mode=index -blog_id=1 -template='youtube'");
system("perl mt-rebuild.pl -mode=index -blog_id=2 -template='out'");

    # 最終アクセス時間を外部ファイルに保存しています
    open HN, ">mt-period.txt";
    print HN $nowtime;
    close HN;
}

1;
