[Logwatch] Weekly and monthly reports?

hvdkooij at vanderkooij.org hvdkooij at vanderkooij.org
Sun Oct 14 15:20:49 MST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hugo van der Kooij wrote:
> Hi,
> 
> I am looking into the weekly and monthly reports. But it seems to me
> logwatch is not clear in that area.

The script below works on Centos 5 and when run on sunday will present a
weekly report. I hold on to the week running from sunday to saterday as
you may gather from the script.

#!/bin/sh

DATE=`date "+%e %B %Y"`
YEAR=`date +%Y --date '7 days ago'`
WEEK=`date +%U --date '7 days ago'`
EMAIL="hugo at vanderkooij.org"
HOST=`hostname`
SUBJECT="Mail server report ${HOST} for ${YEAR}/${WEEK} @ ${DATE}"
LOGWATCH=/usr/sbin/logwatch

${LOGWATCH} --service postfix --service MailScanner --range "between -7
days and -1 days" --detail Low | \
        mail -s "${SUBJECT}" ${EMAIL}

# EOF


Hugo.

- --
hvdkooij at vanderkooij.org               http://hugo.vanderkooij.org/
	Don't meddle in the affairs of sysadmins,
	for they are subtle and quick to anger.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHEpY+BvzDRVjxmYERAigWAJ4sKvDhV7xj7Uu2gknT82ix7CLUagCghQnS
0W+5VKrAqeCYADVGT+7Y154=
=T8q3
-----END PGP SIGNATURE-----


More information about the Logwatch mailing list