projects
/
usenet
/
newsstats.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'thh-small-changes' into next
[usenet/newsstats.git]
/
bin
/
gatherstats.pl
diff --git
a/bin/gatherstats.pl
b/bin/gatherstats.pl
index
92d0545
..
b4f07d9
100755
(executable)
--- a/
bin/gatherstats.pl
+++ b/
bin/gatherstats.pl
@@
-13,7
+13,7
@@
# which Perl itself is published.
BEGIN {
# which Perl itself is published.
BEGIN {
- our $VERSION = "0.0
1
";
+ our $VERSION = "0.0
2
";
use File::Basename;
# we're in .../bin, so our module is in ../lib
push(@INC, dirname($0).'/../lib');
use File::Basename;
# we're in .../bin, so our module is in ../lib
push(@INC, dirname($0).'/../lib');
@@
-38,7
+38,7
@@
my %LegalStats;
### read commandline options
my ($OptCheckgroupsFile,$OptClientsDB,$OptDebug,$OptGroupsDB,$OptTLH,
### read commandline options
my ($OptCheckgroupsFile,$OptClientsDB,$OptDebug,$OptGroupsDB,$OptTLH,
- $OptHostsDB,$OptMonth,$OptRawDB,$OptStatsType,$OptTest);
+ $OptHostsDB,$OptMonth,$OptRawDB,$OptStatsType,$OptTest
,$OptConfFile
);
GetOptions ('c|checkgroups=s' => \$OptCheckgroupsFile,
'clientsdb=s' => \$OptClientsDB,
'd|debug!' => \$OptDebug,
GetOptions ('c|checkgroups=s' => \$OptCheckgroupsFile,
'clientsdb=s' => \$OptClientsDB,
'd|debug!' => \$OptDebug,
@@
-49,11
+49,12
@@
GetOptions ('c|checkgroups=s' => \$OptCheckgroupsFile,
'rawdb=s' => \$OptRawDB,
's|stats=s' => \$OptStatsType,
't|test!' => \$OptTest,
'rawdb=s' => \$OptRawDB,
's|stats=s' => \$OptStatsType,
't|test!' => \$OptTest,
+ 'conffile=s' => \$OptConfFile,
'h|help' => \&ShowPOD,
'V|version' => \&ShowVersion) or exit 1;
### read configuration
'h|help' => \&ShowPOD,
'V|version' => \&ShowVersion) or exit 1;
### read configuration
-my %Conf = %{ReadConfig(
''
)};
+my %Conf = %{ReadConfig(
$OptConfFile
)};
### override configuration via commandline options
my %ConfOverride;
### override configuration via commandline options
my %ConfOverride;
@@
-72,6
+73,8
@@
$OptStatsType = 'all' if !$OptStatsType;
### get time period from --month
# get verbal description of time period, drop SQL code
my ($Period) = &GetTimePeriod($OptMonth);
### get time period from --month
# get verbal description of time period, drop SQL code
my ($Period) = &GetTimePeriod($OptMonth);
+# bail out if --month is invalid or set to 'ALL';
+# we don't support the latter
&Bleat(2,"--month option has an invalid format - please use 'YYYY-MM' or ".
"'YYYY-MM:YYYY-MM'!") if (!$Period or $Period eq 'all time');
&Bleat(2,"--month option has an invalid format - please use 'YYYY-MM' or ".
"'YYYY-MM:YYYY-MM'!") if (!$Period or $Period eq 'all time');
@@
-161,7
+164,7
@@
foreach my $Month (&ListMonth($Period)) {
}
};
};
}
};
};
-
+
# delete old data for that month
if (!$OptTest) {
$DBQuery = $DBHandle->do(sprintf("DELETE FROM %s.%s WHERE month = ?",
# delete old data for that month
if (!$OptTest) {
$DBQuery = $DBHandle->do(sprintf("DELETE FROM %s.%s WHERE month = ?",
@@
-207,7
+210,7
@@
gatherstats - process statistical data from a raw source
=head1 SYNOPSIS
=head1 SYNOPSIS
-B<gatherstats> [B<-Vhdt>] [B<-m> I<YYYY-MM> | I<YYYY-MM:YYYY-MM>] [B<-s> I<stats>] [B<-c> I<filename template>]] [B<--hierarchy> I<TLH>] [B<--rawdb> I<database table>] [B<-groupsdb> I<database table>] [B<--clientsdb> I<database table>] [B<--hostsdb> I<database table>]
+B<gatherstats> [B<-Vhdt>] [B<-m> I<YYYY-MM> | I<YYYY-MM:YYYY-MM>] [B<-s> I<stats>] [B<-c> I<filename template>]] [B<--hierarchy> I<TLH>] [B<--rawdb> I<database table>] [B<-groupsdb> I<database table>] [B<--clientsdb> I<database table>] [B<--hostsdb> I<database table>]
[B<--conffile> I<filename>]
=head1 REQUIREMENTS
=head1 REQUIREMENTS
@@
-258,7
+261,8
@@
override that default through the B<--groupsdb> option.
=head2 Configuration
B<gatherstats> will read its configuration from F<newsstats.conf>
=head2 Configuration
B<gatherstats> will read its configuration from F<newsstats.conf>
-which should be present in the same directory via Config::Auto.
+which should be present in etc/ via Config::Auto or from a configuration file
+submitted by the B<--conffile> option.
See L<doc/INSTALL> for an overview of possible configuration options.
See L<doc/INSTALL> for an overview of possible configuration options.
@@
-340,6
+344,10
@@
Override I<DBTableClnts> from F<newsstats.conf>.
Override I<DBTableHosts> from F<newsstats.conf>.
Override I<DBTableHosts> from F<newsstats.conf>.
+=item B<--conffile> I<filename>
+
+Load configuration from I<filename> instead of F<newsstats.conf>.
+
=back
=head1 INSTALLATION
=back
=head1 INSTALLATION
@@
-410,7
+418,7
@@
Thomas Hochstein <thh@inter.net>
=head1 COPYRIGHT AND LICENSE
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2010-201
2
Thomas Hochstein <thh@inter.net>
+Copyright (c) 2010-201
3
Thomas Hochstein <thh@inter.net>
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
This page took
0.012301 seconds
and
4
git commands to generate.