Servers have multiple users running multiple programs, some of which don't seem to behave and will eat up RAM like there is no tomorrow, for example:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30091 xxxx 20 0 2194m 1.4g 1.4g S 21 9.0 0:56.03 aaaaa
30212 xxxx 20 0 1460m 1.1g 1.1g D 5 6.9 0:44.12 aaaaa
We have filesystem quota setup, otherwise nothing else that I know of. I'd like to be able to limit VIRT RES SHR (perhaps just limiting 1 will limit the other 2?). Is this possible?
As well I would like to limit cputime before command is terminated (actually the command is called by another script, I assume the father script won't be terminated?).
I've had a look at limits.conf and PAM stuff, but not sure what is the best way, and how to test.
You want
setrlimit(RLIMIT_AS, ...)
. From the manpage (setrlimit
(2)):