| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
use DBI; |
|---|
| 15 |
use DBD::Pg; |
|---|
| 16 |
use Schedule::At; |
|---|
| 17 |
use Time::Local; |
|---|
| 18 |
|
|---|
| 19 |
$path = $0; |
|---|
| 20 |
$path =~ s/schedulecheck.pl$//i; |
|---|
| 21 |
if ($pwd ne "./"){ |
|---|
| 22 |
push( @INC, "$path"); |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
require "foltialib.pl"; |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
system("$toolpath/perl/getxml2db.pl"); |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
$now = &epoch2foldate(`date +%s`); |
|---|
| 32 |
$now = &epoch2foldate($now); |
|---|
| 33 |
$checkrangetime = $now + 15*60; |
|---|
| 34 |
$checkrangetime = &epoch2foldate($checkrangetime); |
|---|
| 35 |
|
|---|
| 36 |
my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", |
|---|
| 37 |
$DBDriv,$DBName,$DBHost,$DBPort); |
|---|
| 38 |
$dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; |
|---|
| 39 |
|
|---|
| 40 |
$DBQuery = "SELECT count(*) FROM foltia_tvrecord "; |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
$sth = $dbh->prepare($DBQuery); |
|---|
| 44 |
$sth->execute(); |
|---|
| 45 |
@titlecount= $sth->fetchrow_array; |
|---|
| 46 |
|
|---|
| 47 |
if ($titlecount[0] == 0 ){ |
|---|
| 48 |
exit; |
|---|
| 49 |
}else{ |
|---|
| 50 |
|
|---|
| 51 |
$DBQuery = "SELECT tid ,stationid FROM foltia_tvrecord "; |
|---|
| 52 |
$sth = $dbh->prepare($DBQuery); |
|---|
| 53 |
$sth->execute(); |
|---|
| 54 |
while (($tid,$stationid ) = $sth->fetchrow_array()) { |
|---|
| 55 |
|
|---|
| 56 |
system ("$toolpath/perl/addatq.pl $tid $stationid "); |
|---|
| 57 |
&writelog("schedulecheck $toolpath/perl/addatq.pl $tid $stationid "); |
|---|
| 58 |
|
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
} |
|---|