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

Peter Sørensen maspsr at sdu.dk
Wed Feb 22 08:15:21 CET 2012

Once again - thanks for being so patient :-)

My fault . My script is written in Perl so need to change the $1 to $ARGV[0] then
It worked.

Best regards


-----Oprindelig meddelelse-----
Fra: Mark Sapiro [mailto:mark at msapiro.net] 
Sendt: 21. februar 2012 18:10
Til: Peter Sørensen
Cc: mailman-users at python.org
Emne: Re: [Mailman-Users] run script when virtual-mailman is updated

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