修改core dump文件路径:
方法1:临时修改:
修改/proc/sys/kernel/core_pattern文件/proc目录本身动态加载每次系统重启都会重新加载因此种方法只能作临时修改
/proc/sys/kernel/core_pattern
例:echo ‘/var/log/%e.core.%p’ > /proc/sys/kernel/core_pattern
/proc/sys/kernel/core_pattern
例:echo ‘/var/log/%e.core.%p’ > /proc/sys/kernel/core_pattern
方法2:永久修改:
使用sysctl -w name=value命令
例:/sbin/sysctl -w kernel.core_pattern=/var/log/%e.core.%p了更详尽记录core dump当时系统状态通过下参数来丰富core文件命名:
%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 添加命令名
%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 添加命令名