/[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

Contents of /bin/GetSyncID

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Tue Aug 5 09:20:08 2003 UTC (20 years, 8 months ago) by dpavlin
Branch: MAIN
CVS Tags: debian
Changes since 1.1: +4 -2 lines
change paths to support Debian

1 #!/usr/bin/perl
2 # 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 use lib "/usr/share/postgresql/contrib";
10
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 $RServ::quiet = !$verbose;
41
42 $res = GetSyncID($conn);
43
44 die "ERROR\n" if $res < 0;
45
46 if (! defined $res)
47 {
48 printf STDERR "No SyncID found\n";
49 }
50 else
51 {
52 print("Last SyncID applied: ") if ($verbose);
53 printf "%d", $res;
54 print("\n") if ($verbose);
55 }
56
57 exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26