¡¾ÇóÖú¡¿ÈçºÎÌáÈ¡ÄÚ´æÐÅÏ¢£¿ÓÃshell±à½Å±¾
ÏëÓÃshell±àд¸ö¼òµ¥µÄ³ÌÐò£¬Ä¿µÄÊǼàÊÓÓû§½ø³ÌÕ¼ÓÃÄÚ´æµÄ´óС£¬Èç¹û%Mem³¬¹ýÒ»¶¨µÄÊýÖµ£¬¾Í×Ô¶¯½«Ö®killµô¡£Ïë±àдÕâô¸ö½Å±¾¡£ÓÃtop¿ÉÒԺܺõķ´Ó¦ÊµÊ±µÄÇé¿ö£¬È»ºóÊäÈëm¿ÉÒÔ°´ÕÕÄÚ´æÊ¹ÓÃÇé¿öÅÅÁУ¨Ïë±Ø´ó¼Ò¶¼ÖªµÀ£º£©£©ÓÃʲô·½·¨²ÅÄÜÌáÈ¡ÆäÖеÄÐÅÏ¢£¬È»ºóµ¼È뵽ij¸öÎļþÖÐÄØ£¿¸÷λ¶à¶àÖ¸½Ì°¢£¬Ð»Ð»ÁË¡£:) [code]
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[32734 0] #[/color] ps ax o pid,pmem,rss,comm --sort -rss | head -n 20
PID %MEM RSS COMMAND
3965 2.9 7416 xxxxxx
17104 2.5 6468 vim
4382 2.5 6432 xxxxxx
31488 1.8 4592 xxxxxx
31494 1.8 4592 xxxxxx
31499 1.8 4592 xxxxxx
27389 1.4 3600 ntpd
3966 0.9 2512 bash
28278 0.9 2464 bash
28320 0.9 2432 sshd
28276 0.9 2424 sshd
32734 0.9 2416 bash
32609 0.9 2408 bash
3969 0.9 2356 bash
3975 0.9 2356 bash
3968 0.9 2292 bash
3973 0.8 2220 bash
3970 0.8 2128 bash
3971 0.7 2024 bash
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[32734 0] #[/color] o
[/code] лл°ßÖñ£¬ÊÜÄãÆô·¢£¬ÎÒ°ÑuserÒ²¼ÓÉÏÈ¥ÁË¡£ÈçÏ£º
ps -eo pid,user,cputime,pmem,rss,comm --sort -rss | head -n 20 good :) °³ÊÇÐÂÊÖ£¬³õÀ´´Ë̳£¬»¹Çë°ßÖñ´óÈ˶à¶à¹ØÕÕ°¢¡£:) ¿ÍÆø »¥ÏཻÁ÷ ÕâÊDz»Âé·³Á˵ãѽ£¿
Ö±½ÓÏÞÖÆmemµÄʹÓÃ
[code]
[0 No.1955 huan@huan ~/svn-ubu]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) unlimited
[B]max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited[/B]
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) unlimited
max rt priority (-r) unlimited
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[0 No.1956 huan@huan ~/svn-ubu]$
[/code] Õâ¸öÊÇÏÞÖÆµ¥Óû§µÄ»¹ÊÇϵͳµÄ£¿ Õâ¸öÃüÁîÓ¦¸Ãµ¥¸öÓû§µÄ
È«¾ÖÉèÖÿɲÎÊýÒÔÏÂÅäÖÃ
[code]
[0 No.1831 huan@huan ~]$ cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
#
#<domain> <type> <item> <value>
#
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
# End of file
[0 No.1832 huan@huan ~]$
[/code] ¿´µ½ÁË£¬Êǵ¥Óû§µÄ ³¤¼ûʶ£¡³¤¼ûʶ£¡ °³Ò²³¤¼ûʶÁË »¹ÊÇ»¶»¶À÷º¦ :) ÎÒÔõô¾õ×ŶàÓû§Ò²¿ÉÒÔÄØ£¿£¿
¾ÍÔÚ·þÎñÆ÷ÉÏÉèÖÃÕâôһÏ¡£ÆäËûÔÚ´Ë·þÎñÆ÷ÉÏÔËÐÐ×÷ÒµµÄÄܲ»ÄÜÊÜÏÞÖÆ£¿ ºÃºÃ¿´¿´Õâ¸öÎļþѽ
ÀïÃæµÄ×¢ÊͶ¼ËµµÃºÜÇå³þÁË
/etc/security/limits.conf
[quote]
#Where:
# can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
[/quote] Á˽âÁË¡££º£©
ѧϰÁËÓÖ£¡ ÇëÎÊÔõôÑùÔÚlimits.confÎļþÖÐÉèÖÃmax memory size??ллÁË¡£ [code]
[0 No.1998 huan@huan ~]$ cat ~test/ulimit
Script started on 2006Äê12ÔÂ17ÈÕ ÐÇÆÚÈÕ 11ʱ58·Ö20Ãë
test@huan:~$ whoami
test
test@huan:~$ ulimit -m
1025
test@huan:~$ grep rss /etc/security/limits.conf
# - rss - max resident set size (KB)
#* hard rss 10000
test hard rss 1025
test@huan:~$ exit
Script done on 2006Äê12ÔÂ17ÈÕ ÐÇÆÚÈÕ 11ʱ59·Ö01Ãë
[0 No.1999 huan@huan ~]$
[/code]
ÒÔÉÏÐÅÏ¢ÊÇtestÓû§ÔÚscriptÖмǼµÄ
rssÏîÓÃÒÔÉèÖÃ×î´óÄÚ´æ
ulimit -m ¿ÉÒÔÈ·ÈÏÕâ¸öÉèÖà ¶àлjiahuan,ÎÊÌâÒѾ½â¾ö¡£
[QUOTE=li-jiahuan][code]
[0 No.1998 huan@huan ~]$ cat ~test/ulimit
Script started on 2006Äê12ÔÂ17ÈÕ ÐÇÆÚÈÕ 11ʱ58·Ö20Ãë
test@huan:~$ whoami
test
test@huan:~$ ulimit -m
1025
test@huan:~$ grep rss /etc/security/limits.conf
# - rss - max resident set size (KB)
#* hard rss 10000
test hard rss 1025
test@huan:~$ exit
Script done on 2006Äê12ÔÂ17ÈÕ ÐÇÆÚÈÕ 11ʱ59·Ö01Ãë
[0 No.1999 huan@huan ~]$
[/code]
ÒÔÉÏÐÅÏ¢ÊÇtestÓû§ÔÚscriptÖмǼµÄ
rssÏîÓÃÒÔÉèÖÃ×î´óÄÚ´æ
ulimit -m ¿ÉÒÔÈ·ÈÏÕâ¸öÉèÖÃ[/QUOTE]
Ò³:
[1]