LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2009, 11:08 PM   #1
Andys_sumy
LQ Newbie
 
Registered: Dec 2009
Posts: 6

Rep: Reputation: 0
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
 
Old 12-02-2009, 11:20 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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
 
Old 12-02-2009, 11:40 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Try ulimit -t http://linux.die.net/man/1/ulimit
 
Old 12-02-2009, 11:56 PM   #4
Andys_sumy
LQ Newbie
 
Registered: Dec 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
ulimit -t limit time only for one session, after relogin user can work again
 
Old 12-03-2009, 12:02 AM   #5
Andys_sumy
LQ Newbie
 
Registered: Dec 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by paulsm4 View Post
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?
 
Old 12-03-2009, 09:10 AM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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.
 
Old 12-03-2009, 05:44 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Can you explain more clearly what you are after?
 
Old 12-04-2009, 08:34 AM   #8
Andys_sumy
LQ Newbie
 
Registered: Dec 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
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.
 
Old 12-06-2009, 06:57 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
etc/security/limits.conf - what does it do? Ken_1969 Red Hat 5 03-14-2010 04:25 PM
How do I activate limits.conf davidstvz Linux - Newbie 2 09-18-2009 12:46 PM
CPU Limits Harlin Linux - General 4 05-18-2008 02:18 AM
/etc/security/limits.conf reverse Linux - Security 4 10-20-2007 03:10 PM
limits are not working (limits.conf) PkerC Red Hat 3 06-22-2006 10:14 AM


All times are GMT -5. The time now is 08:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration