summaryrefslogtreecommitdiff
path: root/rhimport-mz
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2013-03-27 12:40:31 (GMT)
committerChristian Pointner <equinox@helsinki.at>2013-03-27 12:40:31 (GMT)
commit25d59b138b85e092bede8b530d6a92bb8ac8d380 (patch)
treeb6403e95845f92f50cdad565586c0b072dc5288d /rhimport-mz
parent4260b5158eb65bc3037c0d2cea289c2a8d4a0c11 (diff)
added stat file for rhimport-mz
Diffstat (limited to 'rhimport-mz')
-rwxr-xr-xrhimport-mz17
1 files changed, 17 insertions, 0 deletions
diff --git a/rhimport-mz b/rhimport-mz
index 2de5257..3ad4786 100755
--- a/rhimport-mz
+++ b/rhimport-mz
@@ -38,7 +38,10 @@ my $DBUSER = "rivendell";
my $DBPW = "lldriven";
my $DB = "rivendell";
+
my @STATIC_FILES = ($ENV{'HOME'} . "/frontex", $ENV{'HOME'} . "/maribor" );
+
+my $STAT_FILE = $ENV{'HOME'} . "/rhimport-mz.stat";
my $ZF_NOTE_FILE = $ENV{'HOME'} . "/rhimport-zf.last_note";
my $ZF_NEW_FILE = $ENV{'HOME'} . "/rhimport-zf.is_new";
my $PV_ID = '320';
@@ -91,6 +94,15 @@ if(scalar(@allowed_dbs) != 1) {
}
my $dropbox = $allowed_dbs[0]->{'PATH'};
+
+my $import_date = sprintf("%04d-%02d-%02d", @import_day);
+my $current_date = `cat $STAT_FILE`;
+if($current_date eq $import_date) {
+ print "Already downloaded file of day in question\n";
+ $dbh->disconnect();
+ exit 0;
+}
+
unless(-e $ZF_NEW_FILE) {
print "zip-fm not imported yet - ";
if($#ARGV >= 0 && $ARGV[0] eq 'last') {
@@ -216,6 +228,11 @@ if(!$ret) {
exit 1;
}
+unlink($STAT_FILE);
+open(my $fhs, '>', $STAT_FILE);
+print $fhs $import_date;
+close($fhs);
+
unlink($ZF_NEW_FILE);
foreach my $dir (@STATIC_FILES) {
open(my $fhs, '>', "$dir/.current");