Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2:Update
postgrey
postgrey_daily_greylist.crontab
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File postgrey_daily_greylist.crontab of Package postgrey
#!/bin/bash # # (c) Copyright Klaus Singvogel, 2008 # All rights reserved. # # This script searches for relevant entries in mail log, generates # a daily report from this data, and sends them in a (human) readable # to specified user # # suggested to use with cron, before the logfiles got rotated by # logrotate mechanism (otherwise bzcat/zcat has to be used) # reference to variable DAILY_TIME in /etc/sysconfig/cron when the # logfiles got rotate (exceptions to this rule possible) # variables to modify to personal settings reciepient=klaus logfile=/var/log/mail report_flags="--check_sender=mx,a" # report_flags='--separate_by_subnet=":==================\n" --nosingle_line --check_sender=mx,a' # better, not to modify these variables TEMPFILE=$(mktemp "/tmp/greylist.XXXXXX") || exit 1 date=`date -d yesterday +"%b %2e"` # for compressed logfiles... today=`date +"%Y%m%d"` yesterday=`date -d yesterday +"%Y%m%d"` if [ ! -r "$logfile" ]; then echo "no logfile $logfile" | \ mail -s "greylist: no greylisted host" $reciepient rm $TEMPFILE exit 1 fi if [ -z "$logfile" ]; then echo "empty logfile $logfile" | \ mail -s "greylist: no greylisted host" $reciepient rm $TEMPFILE exit 1 fi if [ -r "$logfile"-"$today".bz2 ]; then ( cat "$logfile"; bzcat "$logfile"-"$today".bz2; ) |\ grep postgrey | \ grep "$date" > $TEMPFILE elif [ -r "$logfile"-"$yesterday".bz2 ]; then ( cat "$logfile"; bzcat "$logfile"-"$yesterday".bz2; ) |\ grep postgrey | \ grep "$date" > $TEMPFILE else cat "$logfile" | \ grep postgrey | \ grep "$date" > $TEMPFILE fi if [ `wc -l < $TEMPFILE` -gt 1 ]; then /usr/sbin/postgreyreport "$report_flags" < $TEMPFILE | \ mail -s "greylist: yesterdays greylisted host" $reciepient else ( echo "no entries >$date< found in logfile $logfile" ; date; echo ""; ls -ls $logfile; echo ""; ls -ls $TEMPFILE; echo ""; ) | \ mail -s "greylist: no greylisted hosts" $reciepient fi rm $TEMPFILE
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor