可以在/etc/sysctl.conf里設(shè)置。

%e: 可執(zhí)行文件名
%p: 進(jìn)程的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
在上面的設(shè)置下,如果一個(gè)名為 test的程序產(chǎn)生了core dump, 則他的名字為 test.core.123 (這里假設(shè)其pid為 123)
如果在 sysctl.conf里改變了設(shè)置,之后要執(zhí)行 sysctl -p 使之生效。
設(shè)置生成壓縮的 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 里有對于這個(gè)管道符號的解釋:

-
Linux
+關(guān)注
關(guān)注
88文章
11761瀏覽量
219071 -
文件
+關(guān)注
關(guān)注
1文章
594瀏覽量
26066 -
虛擬機(jī)
+關(guān)注
關(guān)注
1文章
972瀏覽量
30486
發(fā)布評論請先 登錄
如何共享文件給虛擬機(jī)中的Linux系統(tǒng)
使用VMware給虛擬機(jī)安裝linux系統(tǒng)
虛擬機(jī):QEMU虛擬機(jī)和主機(jī)無線網(wǎng)絡(luò)通訊設(shè)置
VMware虛擬機(jī)和主機(jī)傳輸文件
linux虛擬機(jī)使用教程
虛擬機(jī)linux怎么編寫程序
怎么安裝linux虛擬機(jī)
虛擬機(jī)數(shù)據(jù)恢復(fù)—EXT4文件系統(tǒng)下KVM虛擬機(jī)數(shù)據(jù)恢復(fù)案例
服務(wù)器數(shù)據(jù)恢復(fù)—KVM虛擬機(jī)raw格式磁盤文件數(shù)據(jù)恢復(fù)案例
虛擬機(jī)數(shù)據(jù)恢復(fù)—KVM虛擬機(jī)被誤刪除的數(shù)據(jù)恢復(fù)案例
虛擬機(jī):Linux設(shè)置core dump文件名的格式
評論