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

Annotation of /bin/ApplySnapshot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide 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: +5 -3 lines
change paths to support Debian

1 dpavlin 1.2 #!/usr/bin/perl
2 dpavlin 1.1 # 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 dpavlin 1.2 use lib "/usr/share/postgresql/contrib";
10 dpavlin 1.1 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 dpavlin 1.2 my $conn = Pg::connectdb($sinfo);
36 dpavlin 1.1
37     my $inpf = new IO::File;
38     $inpf = STDIN;
39    
40 dpavlin 1.2 $RServ::quiet = !$verbose;
41    
42 dpavlin 1.1 $res = ApplySnapshot ($conn, $inpf);
43    
44     if ($res > 0)
45     {
46     printf STDERR "Snapshot applied\n";
47     }
48     elsif ($res != 0)
49     {
50     printf STDERR "ERROR\n";
51     exit(1);
52     }
53    
54     exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26