Re: [Exim] How to hold system filter

Góra strony
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
Dla: Marc Haber
CC: exim-users
Temat: Re: [Exim] How to hold system filter
On Wed, 5 Mar 2003, Marc Haber wrote:

> when updating a program that is called from a system filter, it is
> generally a good idea to stop the system filter from being called
> while the work is in progress. But of course, one would like to have
> the server continue accepting mail.


If the program is just one file, the way to do this is to install the
new version by renaming, which is an atomic action in Unix. A variant on
this is to use a symbolic link to the version of the program that is
current. You start of with

link -> old_program

Then, to install a new program without stopping anything, you obey

ln -s new_program new_link

we now have

new_link -> new_program

Then obey

mv -f new_link link

Of course, what you should actually do is create a script for that, and
insert tests for failure along the way. I will put my "move_alias"
script below:

> When I set hold_domains, the message is accepted and put on the queue.
> But the system filter is called in the progress.


That is true. A delivery process is started - and if there are any
recipients that are NOT in hold_domains, those addresses will be
delivered.

> Is there any more easy way to achive the desired behavior of incoming
> messages being put on the queue without the system filter being
> invoked, while invoking the system filter on these messages before
> actually delivering them?


Set "control = queue_only" in the ACL. But then this will apply to all
the addresses in the message. (In the next release of Exim, where there
are some variables you can use to remember things from one ACL call to
the next, you could arrange to do this only if all the recipients were
in some list, rather than if any of them are in the list.)

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.




#!/bin/sh

# Move alias $1 to file $2

if [ "$1" = "" -o "$2" = "" ] ; then
echo 'Usage: move_alias <alias name> <file name>'
exit 1
fi

if [ ! -f "$1" ] ; then
echo $1 does not exist
exit 1
fi

if [ ! -f "$2" ] ; then
echo $2 does not exist
exit 1
fi

ln -s $2 temporary_alias
if [ $? -ne 0 ] ; then exit $? ; fi
mv -f temporary_alias $1