linux core文件名长度,虚拟机:Linux设置core dump文件名的格式

可以在/etc/sysctl.conf里设置。

53cf6d9a46213539443fd49dc8d3916a.png

%e: 可执行文件名

%p: 进程的PID

%u: real uid of the process

%g: real gid of the process

%t: the time when the core is dumped

%h: host name

%c: the max size of the core dump file

在上面的设置下,如果一个名为 test的程序产生了core dump, 则他的名字为 test.core.123 (这里假设其pid为 123)

如果在 sysctl.conf里改变了设置,之后要执行 sysctl -p 使之生效。

设置生成压缩的 core文件

首先,创建文件 core_helper:

405730b5fdba311e7168ef4f341bad8a.png

修改 sysctl.conf文件内容:

#cat etc/sysctl.conf

kernel.core_pattern = |/usr/sbin/core_helper %e %p

kernel.core_uses_pid = 0

#cat /proc/sys/kernel/core_pattern

|/usr/sbin/core_helper %e %p

重新执行 sysctl -p 之后,就会生成 test.core.1234.gz 这样的文件。

man core 里有对于这个管道符号的解释:

431d49c54c3a11b829432e009771cba1.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值