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

Annotation of /bin/CleanLog

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Sun Nov 2 10:21:45 2003 UTC (20 years, 5 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -5 lines
moved all info preparation into MkInfo in RServ.pm

1 dpavlin 1.4 #!/usr/bin/perl -w
2 dpavlin 1.1 # CleanLog
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.4 BEGIN {
10     my $basedir = $0; $basedir =~ s#/[^/]+$##;
11     unshift(@INC, "$basedir/../share");
12     }
13 dpavlin 1.1
14 dpavlin 1.4 use strict;
15 dpavlin 1.1 use Getopt::Long;
16     use RServ;
17    
18     $| = 1;
19    
20 dpavlin 1.4 my ($debug,$verbose) = (0,0);
21     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 dpavlin 1.1 }
37    
38 dpavlin 1.5 $RServ::quiet = !$verbose;
39     if ($debug) {
40     $RServ::quiet = 0;
41     no warnings 'vars';
42     $RServ::debug = $debug;
43     }
44    
45 dpavlin 1.1 my $dbname = $ARGV[0];
46     my $howold = $ARGV[1];
47    
48 dpavlin 1.7 my $minfo = MkInfo($dbname,$masterhost,$masterport,$masteruser,$masterpassword);
49 dpavlin 1.1
50     print "Master connection is $minfo\n" if ($debug);
51    
52     my $conn = Pg::connectdb($minfo);
53    
54 dpavlin 1.4 my $res = CleanLog($conn, $howold);
55 dpavlin 1.1
56     exit(1) if $res < 0;
57    
58     printf STDERR "Deleted %d log records\n", $res if $res > 0;
59    
60     exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26