LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How instruction cpu works at limits.conf? (https://www.linuxquestions.org/questions/linux-newbie-8/how-instruction-cpu-works-at-limits-conf-773104/)

Andys_sumy 12-02-2009 11:08 PM

How instruction cpu works at limits.conf?
 
Hi, i need to limit summary working time at system. I tried use limits.conf for this. If only two lines would be there
Quote:

TestUser soft cpu 10
TestUser hard cpu 20
So user TestUser can login at system at any time, work any time period, and when summary time of all its logins reaches 20 mins all his proceses would be killed?
p.s. if i am wrong in method whith which i try set time limit for user, please advice me with right method
p.p.s sorry for bad english

paulsm4 12-02-2009 11:20 PM

Hi -

Frankly, I've never heard of anybody trying to enforce CPU limits under Linux before (I always thought CPU cycles are pretty much like "air" - free and limitless ;)), and I'm not at all sure it can even be done.

However, if you want to look at limits.conf, then you need to learn more about - and configure - PAM. Here are a few links:

http://linux.die.net/man/8/pam.d

http://linux.die.net/man/8/pam_limits

http://linux.die.net/man/5/limits.conf

'Hope that helps .. PSM

chrism01 12-02-2009 11:40 PM

Try ulimit -t http://linux.die.net/man/1/ulimit

Andys_sumy 12-02-2009 11:56 PM

Quote:

Originally Posted by chrism01 (Post 3777974)

ulimit -t limit time only for one session, after relogin user can work again

Andys_sumy 12-03-2009 12:02 AM

Quote:

Originally Posted by paulsm4 (Post 3777952)
Hi -

Frankly, I've never heard of anybody trying to enforce CPU limits under Linux before (I always thought CPU cycles are pretty much like "air" - free and limitless ;)), and I'm not at all sure it can even be done.

However, if you want to look at limits.conf, then you need to learn more about - and configure - PAM. Here are a few links:

http://linux.die.net/man/8/pam.d

http://linux.die.net/man/8/pam_limits

http://linux.die.net/man/5/limits.conf

'Hope that helps .. PSM

Quote:

cpu
maximum CPU time (minutes)
it is
1) max CPU time for one session?
2) max CPU time for one processs?
3) max CPU time = summary time of all logins during period between server reboots?
What developers whanted to say whith commentar for instruction cpu?

paulsm4 12-03-2009 09:10 AM

If you'd read the link, you should have seen this:
Quote:

The pam_limits PAM module sets limits on the system resources that can be obtained in a user-session. Users of uid=0 are affected by this limits, too.

chrism01 12-03-2009 05:44 PM

Can you explain more clearly what you are after?

Andys_sumy 12-04-2009 08:34 AM

Quote:

Originally Posted by chrism01 (Post 3778975)
Can you explain more clearly what you are after?

I need to set time limit for user's summary working time.
If i should do it in another way advise me please.

chrism01 12-06-2009 06:57 PM

The tools as mentioned above give you a limit per login session. That's the way the system works.
If you want to accumulate time over multiple sessions, you'll have to create a script to save/read the accumulated time.
You can check the user's name at login in the /etc/profile, which is called for each new login.


All times are GMT -5. The time now is 01:35 AM.