Pacific-Design.com

    
Home Index

1. Linux

2. ulimit

Linux / ulimit /

ulimit - get and set user limits

Increase Open File Limit

vi /etc/sysctl.conf
    fs.file-max = 65536


vi /etc/security/limits.conf

*       soft    nproc       65535
*       hard    nproc       65535
*       soft    nofile      65535
*       hard    nofile      65535


vi /etc/security/limits.d/90-nproc.conf

*       soft    nproc       65535
*       hard    nproc       65535
*       soft    nofile      65535
*       hard    nofile      65535

# Re-read new sysctl.conf:
/sbin/sysctl -p

OR 

# Reboot
ulimit -a

## Set user limit for CPU, Hard Disk, Memory, Stack, File size
vi /etc/security/limits.conf

Check Server Stack Size


[kevin] ulimit -s
[kevin] 10240

Crontab will execute sequence1.pl every minute and will limit memory usage to 128M

* * * * * ulimit -d 131072 -m 131072 -v 131072; /usr/bin/nice ./sequence1.pl >> /dev/null 2>&1;


vi ~/.bashrc
limit -t 1800

spider@la:~$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) 1800
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited