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

Annotation of /bin/GetSyncID

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations)
Sun Nov 2 10:21:45 2003 UTC (20 years, 7 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -5 lines
moved all info preparation into MkInfo in RServ.pm

1 dpavlin 1.4 #!/usr/bin/perl -w
2 dpavlin 1.1 # GetSyncID
3     # Vadim Mikheev, (c) 2000, PostgreSQL Inc.
4    
5     eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
6     & eval 'exec perl -S $0 $argv:q'
7     if 0;
8    
9 dpavlin 1.4 BEGIN {
10     my $basedir = $0; $basedir =~ s#/[^/]+$##;
11     unshift(@INC, "$basedir/../share");
12     }
13 dpavlin 1.1
14 dpavlin 1.4 use strict;
15 dpavlin 1.1 use Pg;
16     use Getopt::Long;
17     use RServ;
18    
19     $| = 1;
20    
21 dpavlin 1.4 my ($debug,$verbose) = (0,1);
22     my ($help,$slavehost,$slaveport,$slaveuser,$slavepassword);
23 dpavlin 1.1
24 dpavlin 1.4 my $result = GetOptions(
25     "debug!" => \$debug, "verbose!" => \$verbose, "help" => \$help,
26     "slavehost=s" => \$slavehost, "slaveport=i" => \$slaveport,
27     "slaveuser=s" => \$slaveuser, "slavepassword=s" => \$slavepassword,
28     );
29    
30     if (defined($help) || (scalar(@ARGV) < 1)) {
31 dpavlin 1.7 print "Usage: $0 [options] slavedb
32 dpavlin 1.4 Options:
33     --slavehost=hostname --slaveport=port
34     --slaveuser=username --slavepassword=string
35     ";
36     exit ((scalar(@ARGV) < 1)? 1:0);
37 dpavlin 1.1 }
38    
39 dpavlin 1.5 $RServ::quiet = !$verbose;
40     if ($debug) {
41     $RServ::quiet = 0;
42     no warnings 'vars';
43     $RServ::debug = $debug;
44     }
45    
46 dpavlin 1.1 my $dbname = $ARGV[0];
47    
48 dpavlin 1.8 my $sinfo = MkInfo($dbname,$slavehost,$slaveport,$slaveuser,$slavepassword);
49 dpavlin 1.1
50     print("Connecting to '$sinfo'\n") if ($debug || $verbose);
51     my $conn = Pg::connectdb($sinfo);
52    
53 dpavlin 1.4 my $res = GetSyncID($conn);
54 dpavlin 1.1
55 dpavlin 1.6 if (! defined $res || $res < 0)
56 dpavlin 1.1 {
57 dpavlin 1.6 printf STDERR "No SyncID found in $dbname\n";
58     exit(1);
59 dpavlin 1.1 }
60     else
61     {
62     print("Last SyncID applied: ") if ($verbose);
63     printf "%d", $res;
64     print("\n") if ($verbose);
65     }
66    
67     exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26