Linux – Limiting maximum cpu time for user-launched programs

centoscpu-usagelinuxnice

We have a cluster running CentOS with Sun Grid Engine for research simulations. However, some users who aren't too familiar with the system end up running jobs on the head node, which of of course makes things slow for everyone else.

In the future, I'd like to put an SSH login message warning people of a maximum run time for programs run by users directly on the head node, but also allow long jobs to run (e.g. a big tar/gzip operation) if they nice it.

TL;DR: how do I limit jobs run by users to 24 hours cpu time, if the nice value <= 0?

Best Answer

You can try to write a script that checks jobs running and record their utilization and decides what to do after a certain ammount. You can also try AND - Auto Nice Daemon and ulimits/PAM limits to limit the CPU time of a user (after that much cpu time is used by a user, the processes/sessions are killed).

Related Topic