/[rserv]/bin/MasterSync
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/MasterSync

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

revision 1.5 by dpavlin, Tue Aug 5 21:43:24 2003 UTC revision 1.7 by dpavlin, Sun Nov 2 10:21:45 2003 UTC
# Line 19  $| = 1; Line 19  $| = 1;
19    
20  my ($debug,$verbose,$quiet) = (0,0,0);  my ($debug,$verbose,$quiet) = (0,0,0);
21  my ($help,$masterhost,$masterport,$masteruser,$masterpassword);  my ($help,$masterhost,$masterport,$masteruser,$masterpassword);
22    my $sserver = 1;
23    
24  my $result = GetOptions(  my $result = GetOptions(
25          "debug!" => \$debug, "verbose!" => \$verbose,          "debug!" => \$debug, "verbose!" => \$verbose,
26          "quiet!" => \$quiet, "help" => \$help,          "quiet!" => \$quiet, "help" => \$help,
27          "masterhost=s" => \$masterhost, "masterport=i" => \$masterport,          "masterhost=s" => \$masterhost, "masterport=i" => \$masterport,
28          "masteruser=s" => \$masteruser, "masterpassword=s" => \$masterpassword,          "masteruser=s" => \$masteruser, "masterpassword=s" => \$masterpassword,
29            "slaveserver=i" => \$sserver,
30          );          );
31    
32  if (defined($help) || (scalar(@ARGV) < 2) || ($ARGV[1] !~ /^\d+$/)) {  if (defined($help) || (scalar(@ARGV) < 2) || ($ARGV[1] !~ /^\d+$/)) {
# Line 33  Options: Line 35  Options:
35          --masterhost=hostname --masterport=port          --masterhost=hostname --masterport=port
36          --masteruser=username --masterpassword=string          --masteruser=username --masterpassword=string
37          --quiet          --quiet
38            [--slaveserver=slave_number]
39  ";  ";
40      exit ((scalar(@ARGV) < 2)? 1:0);      exit ((scalar(@ARGV) < 2)? 1:0);
41  }  }
# Line 45  if ($debug) { Line 48  if ($debug) {
48  }  }
49    
50  my $master = $ARGV[0] || "master";  my $master = $ARGV[0] || "master";
 my $server = 0;  
51  my $syncid = $ARGV[1] || die "SyncID not specified";  my $syncid = $ARGV[1] || die "SyncID not specified";
52    
53  my $minfo = "dbname=$master";  my $minfo = MkInfo($master,$masterhost,$masterport,$masteruser,$masterpassword);
 $minfo = "$minfo host=$masterhost" if (defined($masterhost));  
 $minfo = "$minfo port=$masterport" if (defined($masterport));  
 $minfo = "$minfo user=$masteruser" if (defined($masteruser));  
 $minfo = "$minfo password=$masterpassword" if (defined($masterpassword));  
54    
55  my $conn = Pg::connectdb($minfo);  my $conn = Pg::connectdb($minfo);
56  if ($conn->status != Pg::PGRES_CONNECTION_OK) {  if ($conn->status != Pg::PGRES_CONNECTION_OK) {
# Line 60  if ($conn->status != Pg::PGRES_CONNECTIO Line 58  if ($conn->status != Pg::PGRES_CONNECTIO
58      exit 1;      exit 1;
59  }  }
60    
61  my $res = SyncSyncID($conn, $server, $syncid);  my $res = SyncSyncID($conn, $sserver, $syncid);
62    
63  if ($res == 0)  if ($res == 0)
64  {  {

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26