=cut
my $cat = shift or die "Usage: $0 catalogname";
-my $dir='@sbindir@/bacula-dir -B -c @sysconfdir@/bacula-dir.conf';
+my $dir_conf='@sbindir@/dbcheck -B -c @sysconfdir@/bacula-dir.conf';
my $wd = "@working_dir@";
sub dump_sqlite
{
my %args = @_;
umask(0077);
- unlink("$wd/pg_service.conf");
- open(PG, ">$wd/pg_service.conf")
- or die "Can't open $wd/pg_service.conf for writing $@";
- print PG "[bacula]
-dbname=$args{db_name}
-user=$args{db_user}
-password=$args{db_password}
-";
+
if ($args{db_address}) {
- print PG "address=$args{db_address}\n";
$ENV{PGHOST}=$args{db_address};
}
if ($args{db_port}) {
- print PG "port=$args{db_port}\n";
$ENV{PGPORT}=$args{db_port};
}
-
- close(PG);
+
$ENV{PGDATABASE}=$args{db_name};
$ENV{PGUSER}=$args{db_user};
$ENV{PGPASSWORD}=$args{db_password};
- exec("HOME='$wd' PGSERVICE=bacula PGSYSCONFDIR='$wd' pg_dump -c > '$wd/$args{db_name}.sql'");
+ exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'");
print "Error while executing postgres dump $!\n";
return 1; # in case of error
}
}
}
-open(FP, "$dir|") or die "Can't get catalog information $@";
+open(FP, "$dir_conf|") or die "Can't get catalog information $@";
# catalog=MyCatalog
# db_type=SQLite
# db_name=regress