Linux 生成 core 文件的方法
2015-10-13 11:45
531 查看
临时修改:
ulimit -c unlimited
echo "/corefile/core.%t.%e.%p.%s" > /proc/sys/kernel/core_pattern
echo 1 /proc/sys/kernel/core_uses_pid
这样临时修改的项目,如果切换shell,或者机器reboot,则设置失效,下面给出永久设置的方法
永久修改:
文件 /etc/security/limits.conf 增加一行
* soft core unlimited
文件 /etc/sysctl.conf 增加两行
kernel.core_pattern = /corefile/core.%t.%e.%p.%s
kernel.core_uses_pid = 1
运行sysctl -p,使之生效
说明:
第一个设置,标示core 文件的大小
第二个设置,标示出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 添加命令名
第三个设置,标示出是否在文件名中给出进程pid,如果此项设置为1,即使前面那项不加%p,也会在core文件中加入pid
ulimit -c unlimited
echo "/corefile/core.%t.%e.%p.%s" > /proc/sys/kernel/core_pattern
echo 1 /proc/sys/kernel/core_uses_pid
这样临时修改的项目,如果切换shell,或者机器reboot,则设置失效,下面给出永久设置的方法
永久修改:
文件 /etc/security/limits.conf 增加一行
* soft core unlimited
文件 /etc/sysctl.conf 增加两行
kernel.core_pattern = /corefile/core.%t.%e.%p.%s
kernel.core_uses_pid = 1
运行sysctl -p,使之生效
说明:
第一个设置,标示core 文件的大小
第二个设置,标示出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 添加命令名
第三个设置,标示出是否在文件名中给出进程pid,如果此项设置为1,即使前面那项不加%p,也会在core文件中加入pid
相关文章推荐
- CentOS6.7系统优化加强牢固脚本
- CentOS6.7系统优化操作流程
- 安装Leptonica、Tesseract-OCR
- Linux(RedHat 5.8)下 安装Jetty 部署 使用
- linux umount 提示device is busy 的解决
- linux的ssh的免密码登录设置
- Linux USB子系统(1)
- vmware克隆Centos6.4虚拟机网卡无法启动问题
- Linux(CentOS)下安装配置和使用PostgreSQL数据库
- Linux学习进阶路线图
- 工作中Linux常用命令
- Linux线程同步---互斥量
- linux多台服务器之间ssh连接无需密码
- linux下查看以某个字母开头都所有文件
- 菜鸟学ubuntu 之 系统安装
- linux更改 DNS 的一般方式
- CentOS 7 Nvidia 显卡驱动安装
- linux文件实时同步
- Linux下创建管理员权限用户
- linux环境下Markdown编辑器汇总