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

Contents of /bin/ApplySnapshot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Wed Dec 20 17:22:35 2000 UTC (23 years, 4 months ago) by dpavlin
Branch: DbP
CVS Tags: rserv_0_1, r0
Changes since 1.1: +0 -0 lines
import of rserv 0.1 distributed in directories

1 # -*- perl -*-
2 # ApplySnapshot
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 "@LIBDIR@";
10 use IO::File;
11 use RServ;
12 use Getopt::Long;
13
14 $| = 1;
15
16 $result = GetOptions("debug!", "verbose!", "help",
17 "host=s", "user=s", "password=s");
18
19 my $debug = $opt_debug || 0;
20 my $verbose = $opt_verbose || 0;
21 my $snapshot = $opt_snapshot || "__Snapshot";
22
23 if (defined($opt_help) || (scalar(@ARGV) < 1)) {
24 print "Usage: $0 --host=name --user=name --password=string slavedb\n";
25 exit ((scalar(@ARGV) < 1)? 1:0);
26 }
27
28 my $slave = $ARGV[0] || "slave";
29
30 my $sinfo = "dbname=$slave";
31 $sinfo = "$sinfo host=$opt_host" if (defined($opt_host));
32 $sinfo = "$sinfo user=$opt_user" if (defined($opt_user));
33 $sinfo = "$sinfo password=$opt_password" if (defined($opt_password));
34
35 my $conn = Pg::connectdb(sinfo);
36
37 my $inpf = new IO::File;
38 $inpf = STDIN;
39
40 $res = ApplySnapshot ($conn, $inpf);
41
42 if ($res > 0)
43 {
44 printf STDERR "Snapshot applied\n";
45 }
46 elsif ($res != 0)
47 {
48 printf STDERR "ERROR\n";
49 exit(1);
50 }
51
52 exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26