|
FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
login.conf memoryuse not working
I am trying to set a memory limit so that any process using more then the limit I set gets killed or otherwise not allowed to allocate any more memory.
I followed the instructions on http://www.freebsd.org/cgi/man.cgi?q...conf&sektion=5 edited /etc/login.conf In the default class i changed :memoryuse=unlimited:\ to :memoryuse=150M:\ then run cap_mkdb /etc/login.conf I can still run processes that are using more then 150MB memory and nothing happens. What did I do wrong? Im running FreeBSD 6.0-RELEASE |
|
|||
The problem is (at least this was the case for me) that even though that's the "default" class, the users you create on your system (by default) belong to no class.
What can be done is run (as root) chsh <username>, and find the section "Class:". You'll notice there is no entry there. Type "default" after the "Class:" (don't forget a space after the colon) and save that entry. A quick logout-then-back-in for the user affected (after cap_mkdb of course) and the new limits should be in effect. Let me know if this solved your problem.
__________________
I just saved a bunch of money on my car insurance by fleeing the scene of the accident! |
|
|||
Ive already tried editing the class of the user and no difference.
If it makes any difference im trying to limit the memory usage of apache, which starts as root and then changes uid to nobody. So changed the class of user "nobody" to put the memory limit, doesnt work. Does login.conf only apply to users who login (via ssh etc..) or to all processes running under that username no matter how they were started? |
|
||||
I can't say I'm very smart on login.conf but, su allows you to define the login class used when called as root. For example, on my test machine I start mysqld by executing the following:
Code:
su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' Where _mysql is the login class, root is the user to launch it initially and the second -c is passed onto /bin/sh along with it's arguments. You might find it a useful trick. Although I've never tried to push the limits I've had no probs; here is the login.conf entry for good measure: Code:
# # This class is used when running MySQL from /etc/rc.local # XXX: It will *N_O_T* be used when starting/stopping mysqld manually!! # _mysql:\ :ignorenologin:\ :datasize=infinity:\ :maxproc=infinity:\ :openfiles=3580:\ # I've set this to sysctl::kern.maxfiles :stacksize-cur=8M:\ :localcipher=blowfish,8:\ :tc=daemon:
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
Quote:
i reckon this could be used to prioritize/ration memory b/w apps for low memory situations. if you want a cap on mem. then set limits for data, stack and virt. add. space usage. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
some login.conf questions | gosha | OpenBSD General | 2 | 5th July 2009 12:43 PM |
Login automatically | map7 | FreeBSD General | 1 | 12th October 2008 11:09 PM |
difference between rc.conf and loader.conf | disappearedng | FreeBSD General | 5 | 3rd September 2008 05:54 AM |
How can i login to my FreeBSD ?? | ceramic | FreeBSD Installation and Upgrading | 4 | 28th July 2008 11:56 AM |
How to set up ssh login | cssgalactic | FreeBSD General | 12 | 28th June 2008 06:00 PM |