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

Contents of /bin/CleanLog

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Wed Dec 20 17:22:35 2000 UTC (23 years, 4 months ago) by dpavlin
Branch: MAIN
Branch point for: DbP
Initial revision

1 # -*- perl -*-
2 # 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 use lib "@LIBDIR@";
10
11 use Getopt::Long;
12 use RServ;
13
14 $| = 1;
15
16 $result = GetOptions("debug!", "verbose!", "help", "snapshot=s",
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) < 2) || ($ARGV[1] !~ /^\d+$/)) {
24 print "Usage: $PROGRAM_NAME --host=name --user=name --password=string masterdb syncid\n";
25 exit ((scalar(@ARGV) < 2)? 1: 0);
26 }
27
28 my $dbname = $ARGV[0];
29 my $howold = $ARGV[1];
30
31 my $minfo = "dbname=$dbname";
32 $minfo = "$minfo host=$opt_host" if (defined($opt_host));
33 $minfo = "$minfo user=$opt_user" if (defined($opt_user));
34 $minfo = "$minfo password=$opt_password" if (defined($opt_password));
35
36 print "Master connection is $minfo\n" if ($debug);
37 print "Slave connection is $sinfo\n" if ($debug);
38
39 my $conn = Pg::connectdb($minfo);
40
41 $res = CleanLog($conn, $howold);
42
43 exit(1) if $res < 0;
44
45 printf STDERR "Deleted %d log records\n", $res if $res > 0;
46
47 exit(0);

  ViewVC Help
Powered by ViewVC 1.1.26