/[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.3 - (hide annotations)
Tue Aug 5 09:52:36 2003 UTC (20 years, 8 months ago) by dpavlin
Branch: MAIN
Changes since 1.2: +0 -2 lines
rserv 0.2 changes by Nélio Alves Pereira Filho

1 dpavlin 1.2 #!/usr/bin/perl
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.2 use lib "/usr/share/postgresql/contrib";
10 dpavlin 1.1
11     use Pg;
12     use Getopt::Long;
13     use RServ;
14    
15     $| = 1;
16    
17     my $verbose = 1;
18    
19     $result = GetOptions("debug!", "verbose!", "help",
20     "host=s", "user=s", "password=s");
21    
22     my $debug = $opt_debug || 0;
23     my $verbose = $opt_verbose if (defined($opt_verbose));
24    
25     if (defined($opt_help) || (scalar(@ARGV) < 1)) {
26     print "Usage: $0 --host=name --user=name --password=string slavedb\n";
27     exit ((scalar(@ARGV) < 1)? 1: 0);
28     }
29    
30     my $dbname = $ARGV[0];
31    
32     my $sinfo = "dbname=$dbname";
33     $sinfo = "$sinfo host=$opt_host" if (defined($opt_host));
34     $sinfo = "$sinfo user=$opt_user" if (defined($opt_user));
35     $sinfo = "$sinfo password=$opt_password" if (defined($opt_password));
36    
37     print("Connecting to '$sinfo'\n") if ($debug || $verbose);
38     my $conn = Pg::connectdb($sinfo);
39    
40     $res = GetSyncID($conn);
41    
42     die "ERROR\n" if $res < 0;
43    
44     if (! defined $res)
45     {
46     printf STDERR "No SyncID found\n";
47     }
48     else
49     {
50     print("Last SyncID applied: ") if ($verbose);
51     printf "%d", $res;
52     print("\n") if ($verbose);
53     }
54    
55     exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26