From: "senthil" <senthilg(_at_)jadooworks(_dot_)com>
I have been using fetchmail for receiving mails from my pop provider. I
have around 30+ users for whom i recive the mails and distribute them
locally. Now the problem that i am facing is i have a single file with all
the users pop details written in it and i use the file in the command line
like " fetchmail -v -f filename" . The problem with this is when one mail
box is recieving a big attachment the other priority users are kept in
waiting. ( which of course is politics :-D)
Now i would to try the other way of running multiple demons of fetchmail
for all users at a time. Here I have a confusion about how to start this
multiple instances of fetchmail for all users at a time when I start the
server. ( I know the each instance of fetchmail has to be started in the
same users login). Can anyone advise me on this please ?
Off the top of my head, how about the following little script:
#!/bin/bash
cut -d: -f1 /etc/passwd | while read USERNAME
do
if [ -f ~${USERNAME}/.fetchmailrc ]; then
su - ${USERNAME} -c "fetchmail --daemon 300 -f ~/.fetchmailrc"
fi
done
Replacing the first line (#!/bin/bash) with the correct path to either ksh
or bash (though it should also work fine under sh).
Of course, this means that your 30 users could all be hammering the same
POP/IMAP server every 5 minutes. That's not going to make you popular with
the provider. So instead you could do:
#!/bin/bash
cut -d: -f1 /etc/passwd | while read USERNAME
do
if [ -f /etc/fetchmailrc.${USERNAME} ]; then
su - ${USERNAME} -c "fetchmail --daemon 300 -f
/etc/fetchmailrc.${USERNAME}"
fi
done
Allowing you to keep control over the timings. You could probably give some
form of distribution to the timing by using the UID to calculate the poll
interval.
Please DO NOT send me ANY email directly unless it's a privacy issue.
Reply-to mangled to assist those who don't read the above.
--
Rob | What part of "no" was it you didn't understand?
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail