Date: Mon, 10 May 2004 08:52:44 -0500 From: Mark Johnston <mjohnston@skyweb.ca> To: freebsd-isp@freebsd.org Subject: Re: bg proccess limit Message-ID: <200405100852.44320.mjohnston@skyweb.ca> In-Reply-To: <200405080907.i48974WB026257@shark.levkov.com> References: <200405080907.i48974WB026257@shark.levkov.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"Coldfade" <coldfade@levkov.com> wrote: > i mean limit the background proccesses amount ... i work in a shell > providing company but can`t find suitable solution for the BSD > platform This is a Simple Matter of Scripting. Start with: ps -x -U $THEUSER | egrep '^[0-9]+ +\?\?' to find processes owned by THEUSER with no controlling terminal (?? in the TT column in ps). You can use egrep -c to count the processes, then pipe the results of the same grep through tail to find some processes to kill off. Run that once a minute and you're set. For a nicer fix, I'd go to Perl or Python - just run ps aux once, store the results into a hash of arrays (dictionary of lists) by username, then go through that hash/dict, comparing it to your policies, and kill off processes that are over the limit. You could also use ulimit, but that will only let you limit the total number of processes (instead of the number of background processes.) Still, for most users, the number of background processes allowed plus two or three will be sufficient. HTH, Mark
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405100852.44320.mjohnston>