linux 内核参数core_pattern测试
参数介绍
. If the first character of the pattern is a '|', the kernel will treat
the rest of the pattern as a command to run. The core dump will be
written to the standard input of that program instead of to a file.
简单来说,该参数就是可以设定core dump文件的文件名及路径,以及可以利用管道将结果输入给管道右边的程序进行处理。
配置方式
设定core文件的最大值,默认为0,即不生成,只针对当前shell
ulimit -c 1024
查看当前core_pattern配置
#cat /proc/sys/kernel/core_pattern
core-%e-%p-%t
修改参数
#echo "/root/core_dump/core-%e-%p-%t" > /proc/sys/kernel/core_pattern
echo "/home/chenyuhao/core_dump/core-%e-%p-%t" > /proc/sys/kernel/core_pattern
测试方法
模拟生成core dump
sleep 15
按下Ctrl+\
修改core_pattern参数,是否能按照指定的路径及文件名生成dump。
echo "/root/core_dump/core-%e-%p-%t" > /proc/sys/