码迷,mamicode.com
首页 > 系统相关 > 详细

Linux下设置Core文件生成路径及文件名

时间:2017-08-01 19:26:46      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:att   设置   bin   table   通过   路径   var   file   动态   

修改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

方法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 添加命令名

Linux下设置Core文件生成路径及文件名

标签:att   设置   bin   table   通过   路径   var   file   动态   

原文地址:http://www.cnblogs.com/fushou/p/7269692.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!