exit(1);
}
+my %Conf = $bpc->Conf();
+
+my $dbh = DBI->connect($Conf{SearchDSN}, $Conf{SearchUser}, "", { RaiseError => 1, AutoCommit => 0 });
+
+my $sth = $dbh->prepare(qq{
+ select
+ backups.id as backup_id,
+ hosts.name as host,
+ backups.num as num
+ from backups
+ join hosts on hosts.id = hostid
+ where hosts.name = ? and inc_size < 0 and size > 0 and not inc_deleted
+});
+
my $Hosts = $bpc->HostInfoRead();
my $ArchiveHost = $ARGV[0];
my $UserName = $ARGV[1];
print(STDERR "$0: host $host doesn't have any backups... quitting\n");
exit(1);
}
- push(@HostList, $host);
- $num ||= $backups[$#backups]{num};
- push(@BackupList, $num);
+
+ $sth->execute( $host );
+ if ( $sth->rows == 0 ) {
+ warn "no backups to archive on $host\n";
+ next;
+ }
+
+ while ( my $row = $sth->fetchrow_hashref ) {
+ warn "+ ", $row->{host}, " ", $row->{num}, "\n";
+ push(@HostList, $host);
+ push(@BackupList, $row->{num});
+ }
}
my $ReqFileName;
my $t_fmt = '%Y-%m-%d %H:%M:%S';
-warn "## Conf = ",dump( \%Conf );
+#warn "## Conf = ",dump( \%Conf );
my $dbh = DBI->connect($Conf{SearchDSN}, $Conf{SearchUser}, "", { RaiseError => 1, AutoCommit => 0 });