[Mailman-Users] run script when virtual-mailman is updated

Mark Sapiro mark at msapiro.net
Tue Feb 21 18:10:10 CET 2012

On 2/21/2012 12:25 AM, Peter Sørensen wrote:
> Thanks Mark - exactly what I needed. Not quite sure on the $1.
> This I could'nt make work. 

Mailman invokes the POSTFIX_MAP_CMD command with one argument equal to
the path to the virtual-mailman file. The intent is that this will run

/usr/sbin/postmap /path/to/data/virtual-mailman

which will update virtual-mailman.db with the changed virtual-mailman.
Presumably, when you replace /usr/sbin/postmap with
/path/to/your/script, you still want virtual-mailman.db to be updated so
you need

/usr/sbin/postmap $1

somewhere in your script so when Mailman invokes

/path/to/your/script /path/to/data/virtual-mailman

The $1 inside the script is replaced with the first argument and the
script runs

/usr/sbin/postmap /path/to/data/virtual-mailman

You could of course hard code the path to virtual-mailman in the postmap
command in your script instead of using $1 to get it from the invoking
command, but the $1 is more general.

If it failed when you tested your script by hand, that is because you
didn't invoke the script with the /path/to/data/virtual-mailman argument
as Mailman does.

Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list