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

Diff of /bin/CleanLog

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by dpavlin, Wed Dec 20 17:22:35 2000 UTC revision 1.7 by dpavlin, Sun Nov 2 10:21:45 2003 UTC
# Line 1  Line 1 
1  # -*- perl -*-  #!/usr/bin/perl -w
2  # CleanLog  # CleanLog
3  # Vadim Mikheev, (c) 2000, PostgreSQL Inc.  # Vadim Mikheev, (c) 2000, PostgreSQL Inc.
4    
# Line 6  eval '(exit $?0)' && eval 'exec perl -S Line 6  eval '(exit $?0)' && eval 'exec perl -S
6      & eval 'exec perl -S $0 $argv:q'      & eval 'exec perl -S $0 $argv:q'
7      if 0;      if 0;
8    
9  use lib "@LIBDIR@";  BEGIN {
10            my $basedir = $0; $basedir =~ s#/[^/]+$##;
11            unshift(@INC, "$basedir/../share");
12    }
13    
14    use strict;
15  use Getopt::Long;  use Getopt::Long;
16  use RServ;  use RServ;
17    
18  $| = 1;  $| = 1;
19    
20  $result = GetOptions("debug!", "verbose!", "help", "snapshot=s",  my ($debug,$verbose) = (0,0);
21                       "host=s", "user=s", "password=s");  my ($help,$masterhost,$masterport,$masteruser,$masterpassword);
22    
23    my $result = GetOptions(
24            "debug!" => \$debug, "verbose!" => \$verbose, "help" => \$help,
25            "masterhost=s" => \$masterhost, "masterport=i" => \$masterport,
26            "masteruser=s" => \$masteruser, "masterpassword=s" => \$masterpassword,
27            );
28    
29    if (defined($help) || (scalar(@ARGV) < 2) || ($ARGV[1] !~ /^\d+$/)) {
30        print "Usage: $0 [options] masterdb syncid
31    Options:
32            --masterhost=hostname --masterport=port
33            --masteruser=username --masterpassword=string
34    ";
35        exit ((scalar(@ARGV) < 2)? 1:0);
36    }
37    
38  my $debug = $opt_debug || 0;  $RServ::quiet = !$verbose;
39  my $verbose = $opt_verbose || 0;  if ($debug) {
40  my $snapshot = $opt_snapshot || "__Snapshot";          $RServ::quiet = 0;
41            no warnings 'vars';
42  if (defined($opt_help) || (scalar(@ARGV) < 2) || ($ARGV[1] !~ /^\d+$/)) {          $RServ::debug = $debug;
     print "Usage: $PROGRAM_NAME --host=name --user=name --password=string masterdb syncid\n";  
     exit ((scalar(@ARGV) < 2)? 1: 0);  
43  }  }
44    
45  my $dbname = $ARGV[0];  my $dbname = $ARGV[0];
46  my $howold = $ARGV[1];  my $howold = $ARGV[1];
47    
48  my $minfo = "dbname=$dbname";  my $minfo = MkInfo($dbname,$masterhost,$masterport,$masteruser,$masterpassword);
 $minfo = "$minfo host=$opt_host" if (defined($opt_host));  
 $minfo = "$minfo user=$opt_user" if (defined($opt_user));  
 $minfo = "$minfo password=$opt_password" if (defined($opt_password));  
49    
50  print "Master connection is $minfo\n" if ($debug);  print "Master connection is $minfo\n" if ($debug);
 print "Slave connection is $sinfo\n" if ($debug);  
51    
52  my $conn = Pg::connectdb($minfo);  my $conn = Pg::connectdb($minfo);
53    
54  $res = CleanLog($conn, $howold);  my $res = CleanLog($conn, $howold);
55    
56  exit(1) if $res < 0;  exit(1) if $res < 0;
57    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26