]> git.sur5r.net Git - bacula/bacula/blob - bacula/scripts/logwatch/applybaculadate
ec7fe60e01e68d4deef15bc466c9d72e20fb280f
[bacula/bacula] / bacula / scripts / logwatch / applybaculadate
1 #!/usr/bin/perl
2
3 ########################################################################
4 ## Copyright (c) 2009 Sigma Consulting Services Limited
5 ## v1.00 2009/06/21 16:54:23 Ian McMichael
6 ##
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 2 of the License, or
10 ## any later version.
11 ##
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 ########################################################################
20
21 use Logwatch ':dates';
22
23 my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
24
25 $SearchDate = TimeFilter('%d-%b %H:%M');
26
27 if ( $Debug > 5 ) {
28    print STDERR "DEBUG: Inside ApplyBaculaDate...\n";
29    print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
30 }
31
32 my $OutputLine = 0;
33
34 while (defined($ThisLine = <STDIN>)) {
35    if ($ThisLine =~ m/^$SearchDate /o) {
36       $OutputLine = 1;
37    } elsif ($ThisLine !~ m/^\s+/o) {
38       $OutputLine = 0;
39    }
40
41    if ($OutputLine) {
42       print $ThisLine;
43    }
44 }
45
46 # vi: shiftwidth=3 syntax=perl tabstop=3 et