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