可以在/etc/sysctl.conf里設(shè)置。
%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
在上面的設(shè)置下,如果一個名為 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 里有對于這個管道符號的解釋:
-
Linux
+關(guān)注
關(guān)注
87文章
11511瀏覽量
213844 -
文件
+關(guān)注
關(guān)注
1文章
579瀏覽量
25374 -
虛擬機
+關(guān)注
關(guān)注
1文章
966瀏覽量
29373
發(fā)布評論請先 登錄
如何共享文件給虛擬機中的Linux系統(tǒng)

使用VMware給虛擬機安裝linux系統(tǒng)
段錯誤調(diào)試神器 - Core Dump詳解
VMware虛擬機和主機傳輸文件

linux虛擬機使用教程
虛擬機linux怎么編寫程序
怎么安裝linux虛擬機
虛擬機數(shù)據(jù)恢復—EXT4文件系統(tǒng)下KVM虛擬機數(shù)據(jù)恢復案例

服務(wù)器數(shù)據(jù)恢復—KVM虛擬機raw格式磁盤文件數(shù)據(jù)恢復案例

虛擬機數(shù)據(jù)恢復—KVM虛擬機被誤刪除的數(shù)據(jù)恢復案例

評論