summaryrefslogtreecommitdiff
path: root/rhimport-mz
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-07-24 19:01:55 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-07-24 19:01:55 (GMT)
commit6761a44cfb25af3f923a53375f05e75e8570403d (patch)
tree5bb59562bae08a0edf8ea71c62d89f635b6213a7 /rhimport-mz
parentd9df4264e66e6091538ab24c41fad20131526460 (diff)
switch to use systemwide RHRD perl module
Diffstat (limited to 'rhimport-mz')
-rwxr-xr-xrhimport-mz16
1 files changed, 11 insertions, 5 deletions
diff --git a/rhimport-mz b/rhimport-mz
index 57a3805..29b355a 100755
--- a/rhimport-mz
+++ b/rhimport-mz
@@ -28,6 +28,7 @@ use Time::localtime;
use IO::Handle;
use IPC::Open3;
use File::Slurp;
+use RHRD::rddb;
use lib '/usr/local/share/rhimport/';
use rhimport;
@@ -79,15 +80,20 @@ switch($dow) {
else { print("invalid day of week?!\n"); exit 1; }
}
-my ($dbh, $errorstring) = rhimport::opendb();
+my ($dbh, $errorstring) = RHRD::rddb::opendb();
if(!defined $dbh) {
print "$errorstring\n";
exit 1;
}
-my @allowed_dbs = rhimport::get_dropboxes($dbh, $user, $group);
+my @allowed_dbs = RHRD::rddb::get_dropboxes($dbh, $user, $group);
+if(!defined $allowed_dbs[0] && defined $allowed_dbs[2]) {
+ print "$allowed_dbs[2]\n";
+ exit 1;
+}
+
if(scalar(@allowed_dbs) != 1) {
print "found no or more than one Dropboxes for this group?!\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 1;
}
my $dropbox = $allowed_dbs[0]->{'PATH'};
@@ -97,7 +103,7 @@ 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";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 0;
}
@@ -218,7 +224,7 @@ foreach my $file (@files) {
$cart++;
}
-rhimport::closedb($dbh);
+RHRD::rddb::closedb($dbh);
if(!$ret) {
print "\nImport Error:\n";