Controlling Mailman3 from the Linux commandline
All,
Not versed in Python, I found using the Python gateway to Mailman3 commands rather cumbersome for the few and very simple interactions I have with the shell. So I implemented a set of .bash scripts that I use instead. They all have this from, where the last part is the Mailman shell command (in this case the command for adding members in file $1 to the list $2).
#!/bin/bash exec /opt/mailman/mm/venv/bin/mailman -C "/opt/mailman/mm/mailman.cfg" members --addmembers $1 $2
To invoke it:
. addMembers.bash <FILE_OF_EMAIL> <listname>
I have other scripts for commands such as:
List all lists List all members on all lists (with a sort -u) Send an email with a given list's members to a given address Delete members from a list Delete members from all lists Help Count members on a list
Note the one that sends the member list to a given email address. It does this:
#!/bin/bash exec /opt/mailman/mm/venv/bin/mailman -C "/opt/mailman/mm/mailman.cfg" members $2 |grep -v -e "has no members"|sed -e 's/.*/\L&/'|mailx --subject=$2 $1
This one I use a lot because the system has a bug that does not allow moderators to see the list of members on the list they are supposed to moderate. My lists are set up to allow this, but it does not work. The moderators send me an email with the request, I log on and run this script.
I hope this is helpful.
Yours,
Allan
Why do you not use the mailman addmembers command?
Agree, I also had to search for that.
Am Samstag, 18. September 2021, 17:54:01 CEST schrieb Allan Hansen:
All,
Not versed in Python, I found using the Python gateway to Mailman3 commands rather cumbersome for the few and very simple interactions I have with the shell. So I implemented a set of .bash scripts that I use instead. They all have this from, where the last part is the Mailman shell command (in this case the command for adding members in file $1 to the list $2).
#!/bin/bash exec /opt/mailman/mm/venv/bin/mailman -C "/opt/mailman/mm/mailman.cfg" members --addmembers $1 $2
To invoke it:
. addMembers.bash <FILE_OF_EMAIL> <listname>
I have other scripts for commands such as:
List all lists List all members on all lists (with a sort -u) Send an email with a given list's members to a given address Delete members from a list Delete members from all lists Help Count members on a list
Note the one that sends the member list to a given email address. It does this:
#!/bin/bash exec /opt/mailman/mm/venv/bin/mailman -C "/opt/mailman/mm/mailman.cfg" members $2 |grep -v -e "has no members"|sed -e 's/.*/\L&/'|mailx --subject=$2 $1
This one I use a lot because the system has a bug that does not allow moderators to see the list of members on the list they are supposed to moderate. My lists are set up to allow this, but it does not work. The moderators send me an email with the request, I log on and run this script.
I hope this is helpful.
Yours,
Allan
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
participants (2)
-
Allan Hansen
-
Eggert Ehmke