Coredump生成

  1. 开启coredump生成

    ulimit -c unlimited

  2. 使用PID做为Coredump文件名

    echo "1">/proc/sys/kernel/core_uses_pid

  3. 设置coredump file的生成路径

    echo "/mnt/core_%e_%p.core">/proc/sys/kernel/core_pattern


格式说明:

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

你可能感兴趣的:(Coredump生成)