[Mailman-Users] Mailman handler to run sync_members
mark at msapiro.net
Tue Dec 2 02:39:30 CET 2014
On 12/01/2014 07:55 AM, Jon 1234 wrote:
> Would it be possible to implement a custom Mailman handler for this?
> If email is from a particular email address & to a particular list:
> - Create flat file from MySQL query
> - Run sync_members using that file
> - Email the email address detailing the changes made
> Before I try to reinvent the wheel - is there a script for this already out there?
I do this differently. I just run a daily cron does something like:
/home/mark/.cron/get_memb | \
/usr/local/mailman/bin/sync_members -w=yes -g=no -a=no -f - gpc-announce
get_memb happens to be a python script which uses the MySQL-python
package <https://pypi.python.org/pypi/MySQL-python/> to access the MySQL
database and extract a list of
First Last <email>
entries for all current members of my bike club from our database and
gpc-announce is the "all club" announcement list.
The get_memb script is specific to our database, but it could basically
be anything, even just a straight MySQL query, that produces the desired
list (In our case, the logic of determining whether a record in the
table is that of a current member is complex and in some cases involves
looking at dates in other records, thus the python script).
If you want to do this via a triggering email as you propose rather than
cron, you could still use a shell script such as mine and invoke it from
your handler, or skip the script and just invoke something to get the
list and then invoke sync_members on the list
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