install:
$(INSTALL) -m 755 bacula $(DESTDIR)$(SYSCONFDIR)/scripts/services/bacula
+ $(INSTALL) -m 755 applybaculadate $(DESTDIR)$(SYSCONFDIR)/scripts/shared/applybaculadate
$(INSTALL) -m 644 logfile.bacula.conf $(DESTDIR)$(SYSCONFDIR)/conf/logfiles/bacula.conf
$(INSTALL) -m 644 services.bacula.conf $(DESTDIR)$(SYSCONFDIR)/conf/services/bacula.conf
uninstall:
rm -f $(DESTDIR)$(SYSCONFDIR)/scripts/services/bacula
+ rm -f $(DESTDIR)$(SYSCONFDIR)/scripts/shared/applybaculadate
rm -f $(DESTDIR)$(SYSCONFDIR)/conf/logfiles/bacula.conf
rm -f $(DESTDIR)$(SYSCONFDIR)/conf/services/bacula.conf
For manual install copy the files as indicated below:
cp -p scripts/logwatch/bacula /etc/log.d/scripts/services/bacula
+cp -p scripts/logwatch/bacula /etc/log.d/scripts/shared/applybaculadate
cp -p scripts/logwatch/logfile.bacula.conf /etc/log.d/conf/logfiles/bacula.conf
cp -p scripts/logwatch/services.bacula.conf /etc/log.d/conf/services/bacula.conf
chmod 755 /etc/log.d/scripts/services/bacula
+chmod 755 /etc/log.d/scripts/shared/applybaculadate
chmod 644 /etc/log.d/conf/logfiles/bacula.conf
chmod 644 /etc/log.d/conf/services/bacula.conf
--- /dev/null
+#!/usr/bin/perl
+
+########################################################################
+## Copyright (c) 2009 Sigma Consulting Services Limited
+## v1.00 2009/06/21 16:54:23 Ian McMichael
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 2 of the License, or
+## any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+########################################################################
+
+use Logwatch ':dates';
+
+my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
+
+$SearchDate = TimeFilter('%d-%b %H:%M');
+
+if ( $Debug > 5 ) {
+ print STDERR "DEBUG: Inside ApplyBaculaDate...\n";
+ print STDERR "DEBUG: Looking For: " . $SearchDate . "\n";
+}
+
+my $OutputLine = 0;
+
+while (defined($ThisLine = <STDIN>)) {
+ if ($ThisLine =~ m/^$SearchDate /o) {
+ $OutputLine = 1;
+ } elsif ($ThisLine !~ m/^\s+/o) {
+ $OutputLine = 0;
+ }
+
+ if ($OutputLine) {
+ print $ThisLine;
+ }
+}
+
+# vi: shiftwidth=3 syntax=perl tabstop=3 et
use strict;
use POSIX qw(strftime);
-my (@JobName,$JobStatus,$ThisName,$ThisStatus,$ThisDate,$SearchDate);
-my ($Job,$JobId,$JobDate,$Debug,$DebugCounter,%data,$time);
-
-# set the logwatch search date we want
-$time = time;
-
-if ( $ENV{'LOGWATCH_DATE_RANGE'} eq 'yesterday') {
- $SearchDate = strftime("%Y-%m-%d", localtime($time-86400));
-}
-elsif ( $ENV{'LOGWATCH_DATE_RANGE'} eq 'today') {
- $SearchDate = strftime("%Y-%m-%d", localtime($time));
-}
+my (@JobName,$JobStatus,$ThisName,$ThisStatus,$ThisDate);
+my ($Job,$JobId,$JobDate,$Debug,$DebugCounter,%data);
# set debug level
$Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
# Test the line for a new entry, which is a jobid record
if (/^\s*JobId:\s+(\d+)/) {
- # A new entry. Test, then save the previous stuff and
- # set up to grab more.
- if ($JobId and $Job and $JobStatus and $JobDate) {
- $data{$JobId} = {
- "Job" => $Job,
- "JobStatus" => $JobStatus,
- "JobDate" => $JobDate,
- };
- $Job = $JobStatus = $JobDate = "";
- }
$JobId = $1;
next;
}
+
(/^\s*Job:\s*(.*)/) and $Job = $1;
(/^\s*Termination:\s*(.*)/) and $JobStatus = $1;
(/^\s*Job:.*(\d{4}-\d{2}-\d{2})/) and $JobDate = $1;
+
+ if ($JobId and $Job and $JobStatus and $JobDate) {
+ $data{$JobId} = {
+ "Job" => $Job,
+ "JobStatus" => $JobStatus,
+ "JobDate" => $JobDate,
+ };
+ $JobId = $Job = $JobStatus = $JobDate = "";
+ }
}
# if we have data print it out, otherwise do nothing
$ThisDate = $data{$Id}{JobDate};
$ThisName =~ s/\s//g;
$ThisStatus =~ s/\s//g;
- if ( $ENV{'LOGWATCH_DATE_RANGE'} eq 'all') {
- $SearchDate = $ThisDate;
- }
- if ($ThisDate eq $SearchDate) {
- print "$ThisDate $Id $ThisName\n $ThisStatus\n\n";
- }
+ print "$ThisDate $Id $ThisName\n $ThisStatus\n\n";
}
}
# Which logfile group...
LogFile = bacula
+*ApplyBaculaDate =
General:
14Jul09
+kes Apply patch in bug #1315 by McMichaeli that fixes scripts/logwatch
kes Add more output when spooling and no space left
ebl Fix postgresql driver bug that displayed <NULL> rows from time to time.
kes More cleanup of bootstrap