[Mailman-Users] running External Archiver on background/foreground

Mohamed CHAARI mohamed.chaari at st.com
Fri Dec 7 08:42:00 CET 2007


Mark Sapiro wrote:
> Mohamed CHAARI wrote:
> 
>> Mark Sapiro wrote:
>>> See
>>> <http://mail.python.org/pipermail/mailman-users/2005-August/045994.html>.
>>>
>> you mentioned, in the thread above (Aug 2005), that it would be better 
>> to have a unique temporary file, to avoid conflict problems ...
>> I've tried this, in mm_cfg.py, using unix timestamp
>>
>> PUBLIC_EXTERNAL_ARCHIVER = 'cat > /var/run/mailman/mail_tmp.$(date +%s); 
>> /usr/local/bin/external_arch.pl %(listname)s &'
>>
>> but without success.
>> is there a way to do it ? should I use Python functions to get unix 
>> timestamp for current date ?
> 
> 
> It looks to me as if you have inherited something from Jean-Philippe GIOLA and
> it is now way more complicated than it needs to be.

yes

> 
> Here are my observations on the above:
> 
> 1) The name "mail_tmp.$(date +%s)" may still not be unique. What if two
> messages arrive to be archived within the same second?
> 
> 2)How does /usr/local/bin/external_arch.pl determine what file to read? And, if
> it just picks one, it could be for the wrong list.
> 
> 3)The reason the above doesn't work at all is mailman interpolates into the
> PUBLIC_EXTERNAL_ARCHIVER string from a dictionary in order to replace
> %(listname)s with the actual listname, but this interpolation sees the %s date
> format and replaces it with the entire dictionary. You have to double the % to
> avoid this. E.g.
> 
> 'cat > /var/run/mailman/mail_tmp.$(date +%%s); /usr/local/bin/external_arch.pl
> %(listname)s &'

ok

> 
> 4) The normal way to do this is to not bother with the tempfile stuff at all,
> but rather to just pipe the message to the external archiver as in
> 
> PUBLIC_EXTERNAL_ARCHIVER = '/usr/local/bin/external_arch.pl %(listname)s'
> 
> Then external_arch.pl can just read it's standard input for the message. If you
> do it this way, you can't run it in the background because it won't get
> standard input from the pipe, but the only reason it might need to run in the
> background is if it does something which locks the list.

which is our case, because of the call to 'arch'

> 
> I think Jean-Philippe GIOLA was doing these wierd contortions because he wanted
> both the normal pipermail archive and an external archive,

yes this is exactly our requirement

> but the normal way
> to do this is to just do normal archiving in Mailman and subscribe an address
> to the list to do the external archiving.
> 

I didn't understand well this solution. can you please explain it, how 
can a subscriber/address do the external archiving ?


Thank you in advance


-- 
---
--Mohamed CHAARI   (mailto : mohamed.chaari at st.com)


More information about the Mailman-Users mailing list