[PLUG] Bash functions...

plug_0 at robinson-west.com plug_0 at robinson-west.com
Sat Oct 21 01:28:56 UTC 2006


I am trying to write a bash script to break a postfix mail log down.
I want to seperate the greylist errors from the blacklist errors, etc.
and when I'm done build a useful web page to inform my users.

I'm at the beginning of a project to provide a way to allow users
to see who should be getting through my mail relays that isn't.  I am 
not really familiar with a method to make postfix more fine grained on 
whether an email server that exhibits problems should be blocked or not
directly, so I'm taking an establish a universal whitelist approach.  
First though, I want to get an informative web page up built on 
information culled from /var/log/maillog.

In bash if I make variable bar local to function foo, is bar global to any
function called from within foo?  Another approach is for me to use an array
to sort multiple strings such as "Service is unavailable;", but I want to
avoid that for now.  In C++ there is a concept called namespaces, but this 
is for object oriented programming.  Yes an array is a common solution
to store a collection of strings uniquely, but you have to know how many
strings you are going to need ahead of time and possibly how long they will
all be.  So far, I use these identifying strings with grep, tail, and head
to search for a particular class of errors and effectively sort it out from
everything else dumping it to a file.  If there is a syslog or postfix
configuration trick to cause my mail server to log in such a way that the
different types of errors are seperated...

Michael C. Robinson

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/



More information about the PLUG mailing list