可以在/etc/sysctl.conf里設置。

%e: 可執(zhí)行文件名
%p: 進程的PID
%u: real uid of the process
%g: real gid of the process
%t: the time when the core is dumped
%h: host name
%c: the max size of the core dump file
在上面的設置下,如果一個名為 test的程序產(chǎn)生了core dump, 則他的名字為 test.core.123 (這里假設其pid為 123)
如果在 sysctl.conf里改變了設置,之后要執(zhí)行 sysctl -p 使之生效。
設置生成壓縮的 core文件
首先,創(chuàng)建文件 core_helper:

修改 sysctl.conf文件內(nèi)容:
#cat etc/sysctl.conf
kernel.core_pattern = |/usr/sbin/core_helper %e %p
kernel.core_uses_pid = 0
#cat /proc/sys/kernel/core_pattern
|/usr/sbin/core_helper %e %p
重新執(zhí)行 sysctl -p 之后,就會生成 test.core.1234.gz 這樣的文件。
man core 里有對于這個管道符號的解釋:

-
Linux
+關注
關注
88文章
11821瀏覽量
219598 -
文件
+關注
關注
1文章
598瀏覽量
26120 -
虛擬機
+關注
關注
1文章
975瀏覽量
30714
發(fā)布評論請先 登錄
如何共享文件給虛擬機中的Linux系統(tǒng)
使用VMware給虛擬機安裝linux系統(tǒng)
VMware虛擬機和主機傳輸文件
linux虛擬機使用教程
虛擬機linux怎么編寫程序
怎么安裝linux虛擬機
虛擬機數(shù)據(jù)恢復—EXT4文件系統(tǒng)下KVM虛擬機數(shù)據(jù)恢復案例
服務器數(shù)據(jù)恢復—KVM虛擬機raw格式磁盤文件數(shù)據(jù)恢復案例
虛擬機數(shù)據(jù)恢復—KVM虛擬機被誤刪除的數(shù)據(jù)恢復案例
虛擬機:Linux設置core dump文件名的格式
評論