8
since=$(($cur - $max_age * 60))
10
echo "Apache error log"
11
echo "================"
12
tail -n $log_lines /var/log/apache2/error_log | perl -MDateTime::Format::Strptime -F';' -ane '
13
my $parser = DateTime::Format::Strptime->new(
14
pattern => "%a %b %d %H:%M:%S.%N %Y"
16
my $formater = DateTime::Format::Strptime->new(
20
$last = $formater->format_datetime($parser->parse_datetime($1));
21
} elsif ($last !~ /\d+/) {
25
' | awk "{ if (\$1 > $since) print \$0 }" | cut -d ' ' -f 2-
30
mails=`mailutil check | cut -d ' ' -f 6`
31
if [ "$mails" == "in" ]; then
32
mails=`mailutil check | cut -d ' ' -f 4`
35
if [ $mails -gt 0 ]; then
36
[ $mails -gt $max_mails ] && mails=$max_mails
39
for id in `seq $mails -1 1`; do
40
mail=$(($mails - $id + 1))
42
lastmail=`echo "type $mail" | mailx -R "" -N`
43
dt=`echo "$lastmail" | grep "From" | head -n 1 | cut -d ' ' -f 3-`
44
last=`date -u --date "$dt" +%s`
45
since=$((($cur - $last) / 60))
46
if [ $since -le $max_age ]; then
47
echo "Cron reports on$dt"
48
echo "========================================"
49
echo "$lastmail" | sed -e '1,/^$/d' | head -n 10