User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
perl:pg-dump-all [2018-09-28 12:12]
ziggi created
perl:pg-dump-all [2020-02-15 00:57] (current)
Line 2: Line 2:
  
 <code perl pg-dump-all.pl>​ <code perl pg-dump-all.pl>​
- 
 #​!/​usr/​bin/​env perl #​!/​usr/​bin/​env perl
  
Line 64: Line 63:
 use DBI; use DBI;
 use strict; use strict;
 +
  
 sub timestamp { sub timestamp {
Line 81: Line 81:
 } }
  
-my $username ​= 'xxxxxxx'+my @pghosts ​'pghost1.domain.org''pghost1.domain.org' ​);
-my $password = 'xxxxxx';+
  
-my $pgu = PGu->new($pghost, $username, $password);+foreach ​my $pghost ​(@pghosts{
  
-my $dblist ​= $pgu->​dblist;+    ​my $username ​'​postuser';​ 
 +    my $password = '​superpass'​;
  
-do { +    my $pgu = PGu->​new($pghost,​ $username, $password);​ 
 + 
 +    my $dblist = $pgu->​dblist;​ 
 + 
 +    ​do { 
         alog("​error list databases from $pghost , exit"​);​         alog("​error list databases from $pghost , exit"​);​
         next;         next;
-} if $dblist < 0;+    ​} if $dblist < 0;
  
-foreach my $dbname (sort @{$dblist}) {+    ​foreach my $dbname (sort @{$dblist}) {
  
         next if $dbname =~ m/​template/;​         next if $dbname =~ m/​template/;​
Line 121: Line 125:
 } }
 #EOF #EOF
 +
 </​code>​ </​code>​
  
 ---- ----