为 Redhat 中已有 运行 个进程启用核心转储

Enable Core Dump for already running processes in Redhat

我知道我可以通过在 /etc/profile 文件中输入以下内容来为新进程启用核心转储 ulimit -c unlimited >/dev/null 2>&1

是否可以为已经 运行 个进程启用核心转储?

this post所说,

(On CentOs/Red Hat) 如果你的内核是 2.6.32+,你可以手动更改它,如下所示:

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

否则可以使用prlimit工具(随util-linux 2.21引入),如下:

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

希望对您有所帮助