Search code examples
linuxredhatcoredump

Enable Core Dump for already running processes in Redhat


I understand that I can enable Core Dumps for new processes by making below entry in /etc/profile file ulimit -c unlimited >/dev/null 2>&1

Is it anyhow possible to enable core dumps for already running processes ?


Solution

  • as this post says,

    (On CentOs/Red Hat) If you have a kernel 2.6.32+, you can change it manually as below:

    cd /proc/7671/
    [root@host 7671]# cat limits  | grep nice
    Max nice priority         0                    0
    [root@host 7671]# echo -n "Max nice priority=5:6" > limits
    [root@host 7671]# cat limits  | grep nice
    Max nice priority         5                    6
    

    Otherwise, you can use the prlimit tool (introduced with util-linux 2.21), as follows:

    [root@host 986]# prlimit --core=1000000 --pid 23578
    [root@host 986]# prlimit --pid 23578 | grep CORE
    CORE       max core file size                   1000000   1000000 bytes
    

    Hope it helps