[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: limiting resources

On Mon, Sep 20, 2004 at 08:22:13PM -0400, Adam Aube wrote:
> martin f krafft wrote:
> > Every now and then, coincidence will have it that 10 or 20 users
> > invoke spamassassin at the same time. Spamassassin is a resource
> > hog and that will cause the machine to basically become unusable,
> > with the load going to 30 and higher.
> > Obviously, I have put limits on local deliveries so that postfix
> > itself does not ever screw up the machine. Now I need to limit the
> > local users. Other than PAM limits, which seems to only work on
> > number of processes, is there a way to dynamically limit the load
> > a shell-user can cause? I am talking load-balancing ... give each
> > user 100% unless others want slices too.
> What if you wrote a shell wrapper around SpamAssassin that lowered its
> priority before running it, then had your users run this wrapper instead?
> Adam

How about a serializing wrapper?


#! /bin/sh
set -e
trap 'rm -f /var/tmp/spam.lock' 1 2 15 ERR
lockfile /var/tmp/spam.lock
sa_learn "$@"
rm -f /var/tmp/spam.lock

(Remember to fix errors)

Now, if you make the script NOPASSWD sudo -u sa_learn able, and make
sa_learn only executable by user sa_learn, only one will be running at a

The world's most effective spam filter:
        ln -sf /dev/full /var/mail/$USER

Reply to: