aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/README.mold_remover
blob: 09adddc0c38b49bcf61aab233bc0df2c70044a87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Mold Remover

Mold Remover is a short python script which integrates with fetchmail 
<http://fetchmail.berlios.de/> and allows the user to specify the 
number of days that mail should remain on the pop3 server before being 
deleted. 

It is released under the GNU GPL <http://www.gnu.org/copyleft/gpl.html>.

Usage: 
Set up fetchmail to run with keep and uidl options.
Edit the mold_remover.py file to specify the mailserver address
and login/password details. Also specify the UIDL file created by
fetchmail (this is created automatically by fetchmail when uidl option
is selected in the fetchmailrc file usually at
/var/mail/.fetchmail-UIDL-cache). Remember to chmod the moldremover
script to 700 so that passwords cannot be read. Next, edit the field to
set how many days you want the mail to be left on the server. Lastly
create a script to run moldremover.py with python which can either be
run as a cron job or as part of your connection script. It is advisable
to stop fetchmail before mold remover is run and then to restart
fetchmail afterwards. Here is an example /etc/cron.daily/ script:

#!/bin/bash
/etc/init.d/fetchmail stop >> /var/log/messages
/usr/bin/python /usr/local/bin/mold_remover.py >> /var/log/messages
/etc/init.d/fetchmail start >> /var/log/messages

Please feel free to email me (jmstone@dsl.pipex.com) if you have any questions or bugfixes!

James Stone
8] Message-ID: <33F81C2D.AB822BBB@jrcs.co.uk> Date: Mon, 18 Aug 1997 10:55:57 +0100 From: James Stevens <James.Stevens@jrcs.co.uk> Reply-To: James.Stevens@jrcs.co.uk Organization: JRCS Ltd X-Mailer: Mozilla 4.01 [en] (Win95; I) MIME-Version: 1.0 To: "fetchmail-friends@locke.ccil.org" <fetchmail-friends@locke.ccil.org> Subject: A Little Tip... X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"lhVgRB.A.FFE.bxC-z"@locke.ccil.org> Resent-From: fetchmail-friends@ccil.org X-Mailing-List: <fetchmail-friends@ccil.org> archive/latest/725 X-Loop: fetchmail-friends@ccil.org Precedence: list Resent-Sender: fetchmail-friends-request@ccil.org Status: RO Seeing Eric tip us that we could run a "fetchmail -quit" in the "ip-down" script, I thougt it would be neat to run a fetchmail collection in the "ip-up" script. That way mail is collected automatically every time I am connecting to Internet for whatever reason (I use "diald" to automatically manage my connection). However, it did not work. It hung right after the POP3 login. I tracked this down to the fact that the "pppd" masks a wide range of signals and this means a time-out does not kick in. As I run the "ip-up" script in "bash" this masking is inheritied by "fetchmail". So, I wrote a silly little "C" program that unmasks all signals and then runs a command of you choice (in this case fetchmail). This is the code for that program :- #include <stdio.h> #include <signal.h> main(int argc,char * argv[]) { sigset_t set; if (argc>1) { sigfillset(&set); sigprocmask(SIG_UNBLOCK,&set,NULL); system(argv[1]); } } I call it "allsigs". So, now in my "ip-up" I have the line :- allsigs "fetchmail -f /etc/fetahmail" Note the quotes as "allsigs" only looks at argv[1]. I guess this unmasking of all signals could be added into "fetchmail" ? James