设置core dump开关

1、打开core名称中是否带有pid

echo 1 > /proc/sys/kernel/core_uses_pid

2、/proc/sys/kernel/core_pattern记录的core产生的路径和名称

默认格式为:core.%p_%e

如无路径,则产生在当前目录下。

%p - insert pid into filename 添加pid
%u - insert current uid into filename 添加当前uid
%g - insert current gid into filename 添加当前gid
%s - insert signal that caused the coredump into the filename 添加导致产生core的信号
%t - insert UNIX time that the coredump occurred into filename 添加core文件生成时的unix时间
%h - insert hostname where the coredump happened into filename 添加主机名
%e - insert coredumping executable name into filename添加命令名

3、将ulimit -Sc unlimited &> /dev/null写入/etc/profile。

ulimit -Sc unlimited 变更core文件产生的大小。unlimited为无限制。

原文地址:https://www.cnblogs.com/sageskr/p/3117035.html