更改核心转储的位置 [英] Changing location of core dump

查看:107
本文介绍了更改核心转储的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改核心转储文件的默认位置,以便每次生成核心转储时都将转至该目录.此外,是否可以通过崩溃文件的名称在该位置保存转储文件?

I want to change the default location of core dump files so that every time a core dump is generated ,it goes to that directory.Also, is it possible to save the dump file by the name of the crashed file in this location?

推荐答案

是的.您可以更改/proc/sys/kernel/core_pattern来定义用于生成核心文件的路径名.有关更多信息,请参见 man core

Yes, it is. You can change /proc/sys/kernel/core_pattern to define the pathname used to generate the corefile. For more, see man core

示例:

echo '/tmp/core_%e.%p' | sudo tee /proc/sys/kernel/core_pattern    # `tee' instead of > so that
                                                                   # opening happens in the
                                                                   # elevated process

将导致所有将来的核心转储都在/tmp中生成并命名为core_[program].[pid]

would cause all future core dumps to be generated in /tmp and be named core_[program].[pid]

这篇关于更改核心转储的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆