#!/bin/sh -e # used to be in cvs at cvs/gelfand/mdcc.cx/tools/script # changelog from that era: # #2003-02-08 14:39 joostvb # * run-logreport: [no log message] # #2002-12-31 10:26 joostvb # * run-logreport: try hard to create unique filename # #2002-11-30 00:07 joostvb # * run-logreport: support for graph responder # #2002-03-06 12:07 joostvb # * run-logreport: resistent against new rotate scheme # #2001-12-06 23:54 joostvb # * run-logreport: new names # #2001-09-03 17:29 joostvb # * run-logreport: s/common/combined/ -> we want refferers # #2001-08-19 19:21 joostvb # * run-logreport: [no log message] # domain, e.g. mavetju.org d=$1 # e.g. joostvb-cron-topaz-apache-$d@mdcc.cx t=$2 # e.g. combined.unstable.logreport.org (plain ascii) # or combined.graph.unstable.logreport.org (html with graphs) e=$3 test -n "$e" || e=combined.unstable.logreport.org # logfile should reside in $l/$d/ l=/var/log/apache if test -f $l/$d/combined.log.1 then # new apache rotate mechanism f=$l/$d/combined.log.1 elif test -f $l/$d/combined.log.0 then f=$l/$d/combined.log.0 else echo >&2 $0: no file $l/$d/combined.log.0 nor .1 exit 1 fi echo $t | grep -q '@' || { echo >&2 "$0: second arg $t does not look like email address(es)" exit 1 } # gnu date g=/tmp/combined.${$}.`date +%s`.log.gz gzip -c $f > $g mutt -e "my_hdr Reply-To: $t" \ -s "$d `hostname -f` `date +%Y%m%d`" -a $g \ log@$e < /dev/null rm $g