TWiki
>
CF Web
>
Email
>
MailManManagement
>
MailManManagementGuide
>
MailManManagementGuideSettingsCurl
(2018-12-20,
AdrianPepper
)
(raw view)
E
dit
A
ttach
---+ Using Curl to Change Settings in Mailman Lists <!-- * Set MMHTTP = %URLPARAM{"mmhttp" default="https://"}% * Set MMLISTNAME = %URLPARAM{"mmlist" default="sample"}% * Set MMLIST = %URLPARAM{"mmlist" default="list-name-parameter"}% * Set MMHOST = %URLPARAM{"mmhost" default="lists.uwaterloo.ca"}% * Set MMMM = %URLPARAM{"mmmm" default="/mailman/"}% --> * (rendered for '[[%MMHTTP%%MMHOST%%MMMM%listinfo/%MMLIST%][%MMLISTNAME%]]' list) %TOC% ---++ How to use this page View this page as %TOPICURL%?mmlist=LISTNAME but replace the word _LISTNAME_ with the actual page name for your list. (Perhaps you have already done that...) ---++ Changing settings in a lot of lists. If you maintain (administer) a lot of [[MailManManagementGuide][mailman]] lists it may happen from time-to-time that you realize you have a particular setting you wish to change on many of those lists. Even if you set up a page of links to quickly get to each link, going through all the lists manually can be tedious, time-consuming and error-prone. So this page hints at how an advanced list administrator could make use of tools, in particular the command-line tool [[http://curl.haxx.se/][curl]] to rapidly make similar changes to multiple lists. ---+++ Step 1: Creating URLs to change settings in one list Many mailman pages will accept query parameters to change variables which are indicated within the page. For instance, look at: * [[%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender][%MMLISTNAME% privacy/sender settings]] Note the line <FORM action="%MMHTTP%%MMHOST%%MMMM%/admin/%MMLIST%" > <table WIDTH="100%"> <!-- This excerpt is derived from GNU Mailman, and distributed under the same terms --> <tr> <table CELLPADDING="4" WIDTH="100%" CELLSPACING="3"> <tr> <td BGCOLOR="#dddddd"><div align="right">Action to take when a moderated member posts to the list. <a href="%MMHTTP%%MMHOST%%MMMM%/admin/%MMLIST%/?VARHELP=privacy/sender/member_moderation_action"><br>(Details for <b>member_moderation_action</b>)</a></div></td> <td BGCOLOR="#dddddd"> <table CELLSPACING="5"> <tr> <td><INPUT name="member_moderation_action" type="RADIO" value="0" CHECKED >Hold</td> <td><INPUT name="member_moderation_action" type="RADIO" value="1" >Reject</td> <td><INPUT name="member_moderation_action" type="RADIO" value="2" >Discard</td> </tr> </table> </td> </tr> </table> <p><center> </center> </FORM> If you use browser developer options to view the source for the page, you will see that the three options have corresponding numerical values 0, 1, and 2. And the indicated variable name _member_moderation_action_ is actually a variable which can be specified in a query URL. The following links, which specify the variable _member_moderation_action_ in a query URL, if you are authenticated as list administrator for %MMLIST%, will actually cause the mailman setting to be changed. (Use these links very cautiously! This option was chosen, however, because its value tends to be moot). * [[%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender?member_moderation_action=0][%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender'?member_moderation_action=0']] * [[%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender?member_moderation_action=1][%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender'?member_moderation_action=1']] * [[%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender?member_moderation_action=2][%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender'?member_moderation_action=2']] ---+++ Step 2: Using curl to perform the operation for many lists Generalizing the above, if you have a cookie file which allows you to authenticate to multiple lists, then the _curl_ program can be used to make changes to a list in one line, allowing perhaps many lists to be changed quickly using command-lines without needing to point-and-click in a web browser (except to derive the model URLs). <pre> curl -b cookiefile -s '%MMHTTP%%MMHOST%%MMMM%admin/%MMLIST%/privacy/sender?member_moderation_action=0' > %MMLIST%-output.html </pre> You might repeat that operation, perhaps in a command file, but in this case substituting for %MMLIST% other lists you wish to change (and for which you have cookies in the cookiefile). The _curl_ command is available from http://curl.haxx.se/ but tends to be packaged for most Linux distros. A browser add-on can help you create a suitable cookie file. [[https://addons.mozilla.org/en-US/firefox/addon/cookie-manager/][Advanced Cookie Manager]] seems excellent, and would be well worth contributing to financially. ---++ Notes * Not all variables on all pages can be changed like this * some pages/variables require setting up =POST= data * some variable values may require URL encoding * there is potential here for causing great damage * with great power comes great responsibility ---++ Command-line upload of mailman =listinfo= page If you have a properly-prepared page of =HTML= suitable for use as a "listinfo" page, say =listinfo.html=, and a suitable =cookiefile= you can upload the HTML as follows: <pre> curl -b cookiefile --data-urlencode html_code@listinfo.html -s '%MMHTTP%%MMHOST%%MMMM%edithtml/%MMLIST%/listinfo.html' > %MMLIST%-output.html </pre> Since you should use Mailman variables to parameterize such =listinfo= pages, it will likely be appropriate to perform the same operation for a number of different but similar lists. -- Main.AdrianPepper - 2016-10-14
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
WYSIWYG
|
M
ore topic actions
Topic revision: r4 - 2018-12-20
-
AdrianPepper
CF
Information in this area is meant for use by CSCF staff and is not official documentation, but anybody who is interested is welcome to use it if they find it useful.
CF Web
CF Web Home
Changes
Index
Search
Administration
Communication
Email
Hardware
HelpDeskGuide
Infrastructure
InternalProjects
Linux
MachineNotes
Macintosh
Management
Networking
Printing
Research
Security
Software
Solaris
StaffStuff
TaskGroups
TermGoals
Teaching
UserSupport
Vendors
Windows
XHier
Other Webs
CSEveryBody
Main
Sandbox
TWiki
UW
My links
People
CERAS
WatForm
Tetherless lab
Ubuntu Main.HowTo
eDocs
RGG NE notes
RGG
CS infrastructure
Grad images
Edit
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback