設置core文件格式和生成路徑


默認在執行程序當前目錄下。

 

1 設置core文件格式和生成路徑,執行以下兩條命令: 

echo "1" > /proc/sys/kernel/core_uses_pid 
echo "/corefile/core-%e-%p-%t" > /proc/sys/kernel/core_pattern

將core文件統一生成到/corefile目錄下,產生的文件名為core-命令名-pid-時間戳
注意:/corefile目錄需要自己創建。

 

以下是參數列表:
%p - insert pid into filename 添加pid(進程id)
%u - insert current uid into filename 添加當前uid(用戶id)
%g - insert current gid into filename 添加當前gid(用戶組id)
%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 添加導致產生core的命令名


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM