summaryrefslogtreecommitdiff
path: root/rhimport-mz
diff options
context:
space:
mode:
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");