aboutsummaryrefslogtreecommitdiffstats
path: root/script/load-exim-logs
blob: 5ca0c66f83b8b5ffee8276d47503ab1fb6a85f3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

LOC=`dirname "$0"`

# Specific file if specified
if [ x$1 != x ]
then
    f=`abspath "$1"`
    cd "$LOC"
    bundle exec ./runner 'EximLog.load_file("'$f'")'
    exit
fi

# Load in last three days worth of logs (if they've been modified)
cd "$LOC"
LATEST=$( ls /var/log/exim4/exim-mainlog-* 2>/dev/null | sort | tail -3 )
for X in $LATEST
do
    bundle exec ./runner 'EximLog.load_file("'$X'")'
done