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: Matt Taggart <address@concealed>
  • To: David Verdin <address@concealed>
  • Cc: address@concealed
  • Subject: Re: [sympa-users] setting list priority
  • Date: Wed, 13 Jul 2016 18:44:34 -0700

Hi David,

Back in July 2011 I had asked for a way to set list priority from the
command line, in order to be able to run some scripts to balance our
lists:

https://listes.renater.fr/sympa/arc/sympa-users/2011-07/msg00013.html

you replied with a patch:

https://listes.renater.fr/sympa/arc/sympa-users/2011-07/msg00014.html

which worked, but only if the list already had a priority setting in
it's config

https://listes.renater.fr/sympa/arc/sympa-users/2011-08/msg00002.html

I worked around the problem by writing a script that just added a
priority line to any config that didn't have one before adjusting
it.

I recently remember this patch because I needed to run the our
reprioritization scripts again. I had to adapt the patch a little
due to nearby changes in the code. The updated patch (which applies
against 6.1.22 at least) is attached.

This functionality is still useful, would you consider adding it?
To 6.2 would be fine, to 6.1 would be nice too.

Thanks,

--
Matt Taggart
address@concealed
--- sympa.pl.orig	2016-06-02 01:28:55.305988359 -0700
+++ sympa.pl	2016-06-02 01:32:37.169900394 -0700
@@ -117,6 +117,7 @@
    --md5_digest=password                 : output a MD5 digest of a password (usefull for SOAP client trusted application)
    --test_database_message_buffer        : test the database message buffer size
    --conf_2_db			         : load in database, sympa;conf, wwsympa.conf and each robot.conf
+   --set_list_priority --[list=X] --[robot=Y] --[priority=Z] : Sets the priority of list X\@Y to the value Z
    -h, --help                            : print this help
    -v, --version                         : print version number
 
@@ -131,7 +132,7 @@
 unless (&GetOptions(\%main::options, 'dump=s', 'debug|d', ,'log_level=s','foreground', 'service=s','config|f=s', 
             'lang|l=s', 'mail|m', 'keepcopy|k=s', 'help', 'version', 'import=s','make_alias_file','lowercase','sync_list_db','md5_encode_password',
 		    'close_list=s','rename_list=s','new_listname=s','new_listrobot=s','purge_list=s','create_list','instantiate_family=s','robot=s','add_list=s','modify_list=s','close_family=s','md5_digest=s',
-		    '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','list=s','quiet','close_unknown','test_database_message_buffer','conf_2_db','set_list_priority','priority=n')) {
     &fatal_err("Unknown options.");
 }
 
@@ -158,6 +159,7 @@
 				$main::options{'sync_include'} ||
 				$main::options{'upgrade'} ||
 				$main::options{'upgrade_shared'} ||
+				$main::options{'set_list_priority'} ||
 				$main::options{'test_database_message_buffer'} || 
 				$main::options{'conf_2_db'} || 
 				$main::options{'reload_list_config'} ||
@@ -900,6 +902,34 @@
 
     exit 0;
 
+}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;
+
 }elsif ($main::options{'reload_list_config'}) {
 
     if ($main::options{'list'}) {

Attachment: signature.asc
Description: Digital signature



  • Re: [sympa-users] setting list priority, Matt Taggart, 07/14/2016

Archive powered by MHonArc 2.6.19+.

Top of Page