可以在/etc/sysctl.conf里設置。
%e: 可執行文件名
%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的程序產生了core dump, 則他的名字為 test.core.123 (這里假設其pid為 123)
如果在 sysctl.conf里改變了設置,之后要執行 sysctl -p 使之生效。
設置生成壓縮的 core文件
首先,創建文件 core_helper:
修改 sysctl.conf文件內容:
#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
重新執行 sysctl -p 之后,就會生成 test.core.1234.gz 這樣的文件。
man core 里有對于這個管道符號的解釋:
-
Linux
+關注
關注
87文章
11419瀏覽量
212296 -
文件
+關注
關注
1文章
577瀏覽量
25115 -
虛擬機
+關注
關注
1文章
955瀏覽量
28874
發布評論請先 登錄
相關推薦
如何共享文件給虛擬機中的Linux系統

使用VMware給虛擬機安裝linux系統
VMware虛擬機和主機傳輸文件

linux虛擬機使用教程
虛擬機linux怎么編寫程序
怎么安裝linux虛擬機
虛擬機數據恢復—EXT4文件系統下KVM虛擬機數據恢復案例

評論