one line command to change generic_nonmember_action

I'm writing a simplified mailman dashboard page for my company's internal use and one of the functions we want is to be able to toggle the generic_nonmember_action for any given list. Has anyone out there devised a one line command which will allow this?

Hi,
I'm not sure if there is a direct command that can do this but I've been doing something similar lately. I had a setup of 20+ mailing lists which had to be identical in a specialised configuration. Doing that by the web interface filled me with dread so I started looking around and found the mailman utility 'bin/config_list'.
This brilliant (imnsho!) utility allows you to either dump out a list's configuration in plain text or read in a list's configuration, again in plain text.
Let's see you have a list called SomeList. You can dump out the entire configuration (not the members list, just the list's functional settings) by typing:
cd ~mailman bin/config_list -o - SomeList
This will dump to screen ( -o - ) the configuration of SomeList.
It's just a minor logical step to do
bin/config_list -o /usr/tmp/somelist-conf.txt SomeList
Which dumps the config into a file /usr/tmp/somelist-conf.txt
If you were to look at that file you'd find a section like this:
====== # When a post from a non-member is received, the message's sender is # matched against the list of explicitly <a # href="?VARHELP=privacy/sender/accept_these_nonmembers" >accepted, # held, <a href="?VARHELP=privacy/sender/reject_these_nonmembers" # >rejected (bounced), and <a # href="?VARHELP=privacy/sender/discard_these_nonmembers" >discarded # addresses. If no match is found, then this action is taken. # # legal values are: # 0 = "Accept" # 1 = "Hold" # 2 = "Reject" # 3 = "Discard" generic_nonmember_action = 1
You could either replace the value at the end of the line, or just swap in a whole new line.
Then save the text file and read the configuration BACK to the list:
bin/config_list -i /usr/tmp/somelist-conf.txt SomeList
Note the change from '-o' (output) to '-i' (input).
It would be easily possible to pipe these commands together, maybe using sed as the output=>input parser.
So something like,
bin/config_list -o - SomeList | /usr/bin/sed -f swapscript - |
bin/config_list -i - SomeList
Where 'swapscript' is a simple script to detect the "generic_nonmember_action = 1" line and change it as you want.
Of course there's probably a simpler/better way of doing this but it should work.
Regards, S Watkins
Steff Watkins Natural History Museum, Cromwell Road, London, SW7 5BD Systems programmer Email: s.watkins@nhm.ac.uk Systems Team Phone: +44 (0)20 7942 6000 opt 2
Many were increasingly of the opinion that they'd all made a big mistake in coming down from the trees in the first place. And some said that even the trees had been a bad move, and that no one should ever have left the oceans. - HHGTTG

On Mon, Oct 18, 2010 at 10:46:20AM +0100, Steff Watkins wrote:
I've been quite happy using:
http://code.amyl.org.uk/adam/mailman-scripts/debian/editlistconfig
(patches welcome, should anyone think it necessary)
-- "Any person who knowingly causes a nuclear weapon test explosion or any other nuclear explosion is guilty of an offence" -- Nuclear Explosions Act, 1998

Syn, Joonho wrote:
I'm writing a simplified mailman dashboard page for my company's internal use and one of the functions we want is to be able to toggle the generic_nonmember_action for any given list. Has anyone out there devised a one line command which will allow this?
See the FAQ at <http://wiki.list.org/x/uIA9>.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

I all, who can explain me howto run multiple instances of mailman in a single host (one for different domain)? Do I have to create different /etc/init.d/mailman??
Thank you Bye Alessandro

Alessandro Bruchi wrote:
I all, who can explain me howto run multiple instances of mailman in a single host (one for different domain)? Do I have to create different /etc/init.d/mailman??
Each instance of Mailman needs to be configured with a unique value for prefix (and var-prefix if different from prefix), and each instance needs to be started by its own $prefix/bin/malmanctl. Whether you have separate /etc/init.d/ scripts for each instance or combine them all into one is up to you.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

Hi,
I'm not sure if there is a direct command that can do this but I've been doing something similar lately. I had a setup of 20+ mailing lists which had to be identical in a specialised configuration. Doing that by the web interface filled me with dread so I started looking around and found the mailman utility 'bin/config_list'.
This brilliant (imnsho!) utility allows you to either dump out a list's configuration in plain text or read in a list's configuration, again in plain text.
Let's see you have a list called SomeList. You can dump out the entire configuration (not the members list, just the list's functional settings) by typing:
cd ~mailman bin/config_list -o - SomeList
This will dump to screen ( -o - ) the configuration of SomeList.
It's just a minor logical step to do
bin/config_list -o /usr/tmp/somelist-conf.txt SomeList
Which dumps the config into a file /usr/tmp/somelist-conf.txt
If you were to look at that file you'd find a section like this:
====== # When a post from a non-member is received, the message's sender is # matched against the list of explicitly <a # href="?VARHELP=privacy/sender/accept_these_nonmembers" >accepted, # held, <a href="?VARHELP=privacy/sender/reject_these_nonmembers" # >rejected (bounced), and <a # href="?VARHELP=privacy/sender/discard_these_nonmembers" >discarded # addresses. If no match is found, then this action is taken. # # legal values are: # 0 = "Accept" # 1 = "Hold" # 2 = "Reject" # 3 = "Discard" generic_nonmember_action = 1
You could either replace the value at the end of the line, or just swap in a whole new line.
Then save the text file and read the configuration BACK to the list:
bin/config_list -i /usr/tmp/somelist-conf.txt SomeList
Note the change from '-o' (output) to '-i' (input).
It would be easily possible to pipe these commands together, maybe using sed as the output=>input parser.
So something like,
bin/config_list -o - SomeList | /usr/bin/sed -f swapscript - |
bin/config_list -i - SomeList
Where 'swapscript' is a simple script to detect the "generic_nonmember_action = 1" line and change it as you want.
Of course there's probably a simpler/better way of doing this but it should work.
Regards, S Watkins
Steff Watkins Natural History Museum, Cromwell Road, London, SW7 5BD Systems programmer Email: s.watkins@nhm.ac.uk Systems Team Phone: +44 (0)20 7942 6000 opt 2
Many were increasingly of the opinion that they'd all made a big mistake in coming down from the trees in the first place. And some said that even the trees had been a bad move, and that no one should ever have left the oceans. - HHGTTG

On Mon, Oct 18, 2010 at 10:46:20AM +0100, Steff Watkins wrote:
I've been quite happy using:
http://code.amyl.org.uk/adam/mailman-scripts/debian/editlistconfig
(patches welcome, should anyone think it necessary)
-- "Any person who knowingly causes a nuclear weapon test explosion or any other nuclear explosion is guilty of an offence" -- Nuclear Explosions Act, 1998

Syn, Joonho wrote:
I'm writing a simplified mailman dashboard page for my company's internal use and one of the functions we want is to be able to toggle the generic_nonmember_action for any given list. Has anyone out there devised a one line command which will allow this?
See the FAQ at <http://wiki.list.org/x/uIA9>.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

I all, who can explain me howto run multiple instances of mailman in a single host (one for different domain)? Do I have to create different /etc/init.d/mailman??
Thank you Bye Alessandro

Alessandro Bruchi wrote:
I all, who can explain me howto run multiple instances of mailman in a single host (one for different domain)? Do I have to create different /etc/init.d/mailman??
Each instance of Mailman needs to be configured with a unique value for prefix (and var-prefix if different from prefix), and each instance needs to be started by its own $prefix/bin/malmanctl. Whether you have separate /etc/init.d/ scripts for each instance or combine them all into one is up to you.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (5)
-
Adam McGreggor
-
Alessandro Bruchi
-
Mark Sapiro
-
Steff Watkins
-
Syn, Joonho