1 #------------------------------------------------------------------------------
3 # GotMail - Statistics Printing Script for GetMail
5 # 1999 by Thomas Nesges <ThomaNesges@TNT-Computer.de>
7 #------------------------------------------------------------------------------
9 #------------------------------------------------------------------------------
10 # GotMail reads a GetMail logfile (/var/log/fetchmail.log) and prints
11 # statistics from all sessions logged in it, either as normal text on the
12 # Console, or as an html-file. The parsing is done with the awk-scripts
13 # gotmail.awk and gotmail.html.awk.
14 # You can configure its output with a file gotmail.conf either in your home,
15 # /etc, or in /usr/local/gotmail.
17 # GetMail has to be properly installed. For HTML output the htmllib has to be
18 # installed in /usr/local/htmllib.
20 # If you have any changes/corrections in the script, please send me email.
21 #------------------------------------------------------------------------------
27 # 1999 by Thomas Nesges <ThomasNesges@TNT-Computer.de>
29 # read the configuration
30 # the configuration can either be
33 # /usr/local/gotmail/gotmail.conf
34 if { test -e ~/.gotmail.conf; };
35 then { source ~/.gotmail.conf; };
36 else { if { test -e /etc/gotmail.conf; };
37 then { source /etc/gotmail.conf; };
38 else { if { test -e /usr/local/gotmail/gotmail.conf; };
39 then { source /usr/local/gotmail/gotmail.conf; };
40 else { echo 'Error: gotmail.conf could not be read';
41 echo 'gotmail exits now..';
48 # grep the fetchmail.log for relevant messages and save them in
50 cat /var/log/fetchmail.log | grep 'message' >> /tmp/gotmail.log.tmp
51 cat /var/log/fetchmail.log | grep 'Authorization' >> /tmp/gotmail.log.tmp
52 cat /var/log/fetchmail.log | grep 'fetchmail st' >> /tmp/gotmail.log.tmp
55 # parse the gotmail tempfile and prints a statistiks-screen
58 awk -f /usr/local/htmllib/htmllib.awk -f /usr/local/gotmail/gotmail.html.awk /tmp/gotmail.log.tmp > /dev/null
61 echo 'gotmail version: 0.0.1'
64 awk -f /usr/local/gotmail/gotmail.awk /tmp/gotmail.log.tmp
68 # remove the gotmail tempfile
69 rm /tmp/gotmail.log.tmp