/[rserv]/bin/ApplySnapshot
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/ApplySnapshot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by dpavlin, Tue Aug 5 21:10:28 2003 UTC revision 1.8 by dpavlin, Sun Nov 2 21:07:14 2003 UTC
# Line 19  use Getopt::Long; Line 19  use Getopt::Long;
19  $| = 1;  $| = 1;
20    
21  my ($debug,$verbose) = (0,0);  my ($debug,$verbose) = (0,0);
22  my ($help,$slavehost,$slaveport,$slaveuser,$slavepassword);  my ($help,$slavehost,$slaveport,$slaveuser,$slavepassword,
23  my $snapshot = "__Snapshot";          $multimaster,
24    );
25    my $snapshot;
26    
27  my $result = GetOptions(  my $result = GetOptions(
28          "debug!" => \$debug, "verbose!" => \$verbose, "help" => \$help,          "debug!" => \$debug, "verbose!" => \$verbose, "help" => \$help,
29          "slavehost=s" => \$slavehost, "slaveport=i" => \$slaveport,          "slavehost=s" => \$slavehost, "slaveport=i" => \$slaveport,
30          "slaveuser=s" => \$slaveuser, "slavepassword=s" => \$slavepassword,          "slaveuser=s" => \$slaveuser, "slavepassword=s" => \$slavepassword,
31            "multimaster" => \$multimaster,
32          "snapshot=s" => \$snapshot,          "snapshot=s" => \$snapshot,
33          );          );
34    
# Line 34  if (defined($help) || (scalar(@ARGV) < 1 Line 37  if (defined($help) || (scalar(@ARGV) < 1
37  Options:  Options:
38          --slavehost=hostname --slaveport=port          --slavehost=hostname --slaveport=port
39          --slaveuser=username --slavepassword=string          --slaveuser=username --slavepassword=string
40            --multimaster
41          --snapshot=snapshot          --snapshot=snapshot
42  ";  ";
43      exit ((scalar(@ARGV) < 1)? 1:0);      exit ((scalar(@ARGV) < 1)? 1:0);
# Line 41  Options: Line 45  Options:
45    
46  my $slave = $ARGV[0] || "slave";  my $slave = $ARGV[0] || "slave";
47    
48  my $sinfo = "dbname=$slave";  my $sinfo = MkInfo($slave,$slavehost,$slaveport,$slaveuser,$slavepassword);
 $sinfo = "$sinfo host=$slavehost" if (defined($slavehost));  
 $sinfo = "$sinfo port=$slaveport" if (defined($slaveport));  
 $sinfo = "$sinfo user=$slaveuser" if (defined($slaveuser));  
 $sinfo = "$sinfo password=$slavepassword" if (defined($slavepassword));  
49    
50  my $conn = Pg::connectdb($sinfo);  my $conn = Pg::connectdb($sinfo);
51    
# Line 57  if (defined($snapshot)) { Line 57  if (defined($snapshot)) {
57      $inpf = *STDIN;      $inpf = *STDIN;
58  }  }
59    
60  my $res = ApplySnapshot ($conn, $inpf);  my $res = ApplySnapshot ($conn, $inpf, $multimaster);
61    
62  if ($res > 0)  if ($res > 0)
63  {  {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.26