Skip to Content.
Sympa Menu

en - Re: [sympa-users] setting list priority

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: David Verdin <address@concealed>
  • To: Sympa Users <address@concealed>
  • Subject: Re: [sympa-users] setting list priority
  • Date: Fri, 22 Jul 2011 11:47:31 +0200

Hi Matt,

To build the List object, Sympa does a ton of things (checking the list name, loading config, etc.). It is uneasy to perform all this without reproducing a large part of the sylpa.pl code.
On my opinion, the easiest way to reach your goal is to add a new option to the sympa.pl comand line a go with it.

Attached is a patch to the latest unstable version that does exactly what you want.
Apply the patch to sympa.pl and the use the command: sympa.pl --set_list_priority --list=<listname> --robot=<robotname> --priority=<the new priority value>

It would be cool to have a command line option that would set any list parameter value but that's a tougher job as list parameters are not only single values parametes, so we would have to deal with paragraph style values.
Not so hard after all. Does the list think it would be useful?

Cheers,,

Davdi

Le 21/07/11 22:53, Matt Taggart a écrit :
Hi,

I am looking for a way to programmatically adjust list priority. What I 
would like to do is set list priority based on list size, so that lists 
with fewer subscribers have a higher priority than lists with many 
subscribers. I have split our lists into groups based on size and now I 
want to set their priority. Rather than adjust the config files by hand, I 
know that sympa has functions to make adjustments, rotate the configs 
safely, etc. and I would prefer to use those. I read the code and am trying 
to use the List module but I am having problems. Here's an example of how I 
am trying to use it

  use List;

  $name='test';
  $robot='lists.example.com';

  my $list = new List ($name,$robot) or die "cannot construct\n";
  print "$list->{'admin'}{'priority'}\n";

but when I try to run it dies when constructing.

Is this something I can expect to be able able do with the List module?
Does the above look right?
Can someone provide an example of how to query and set the priority for a 
list?

FYI- my script for adjusting the priorities is at
  http://tinyurl.com/adjustpriority

Thanks,


--
David Verdin
Comité réseau des universités

Due to the limitations of human brain, I fail to remember all the mails.
So if you want your bug reports or feature requests for Sympa to be processed, please post them to the Sympa tracker
116a117
> --set_list_priority --[list=X] --[robot=Y] --[priority=Z] : Sets
> the priority of list X\@Y to the value Z
131c132
<
'input_file=s','sync_include=s','upgrade','upgrade_shared','from=s','to=s','reload_list_config','list=s','quiet','close_unknown','test_database_message_buffer','conf_2_db'))
{
---
>
> 'input_file=s','sync_include=s','upgrade','upgrade_shared','from=s','to=s','reload_list_config','set_list_priority','priority=n','list=s','quiet','close_unknown','test_database_message_buffer','conf_2_db'))
> {
157a159
> $main::options{'set_list_priority'} ||
837a840,868
> ## rename file names that may be incorrectly encoded because of previous
> Sympa versions
> }elsif ($main::options{'set_list_priority'}) {
>
> &do_log('notice', "Setting list priority");
>
> my ($listname, $robot, $priority);
>
> unless (($main::options{'list'}) || ($main::options{'robot'}) ||
> ($main::options{'priority'})){
> &do_log('err', "listname, domain and priority are required,
> use --list= --robot= --priority= options");
> exit 1;
> }
> $listname = $main::options{'list'} ;
> $robot = $main::options{'robot'} ;
> $priority = $main::options{'priority'} ;
>
> &do_log('notice', "Setting list %s@%s priority to
> %s",$listname,$robot,$priority);
>
> my $list = new List ($listname,$robot);
>
> unless (defined $list) {
> printf STDERR "Incorrect list or domain name : %s
> %s\n",$listname,$robot;
> exit 1;
> }
> &do_log('trace','Old priority: %s, New priority:
> %s',$list->{'admin'}{'priority'},$priority);
> $list->{'admin'}{'priority'} = $priority;
> $list->save_config;
>
> exit 0;
>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.19+.

Top of Page