By default on many Linux distributions core files generation is disabled.
If you choose to enable it (because let's say you might have applications crashing and you want to see an image of the application's process memory at the time of termination) and control the name of the core file generated you need to edit /proc/sys/kernel/core_pattern. The default value in this file is "core", which means that core files will be dumped in the working directory and the filename is core. If you want to change this pattern and dump the core files in /tmp direcory and also append the process ID to the file name do the following (be aware that this is a system wide settting):
%% A single % character
%p PID of dumped process
%u real UID of dumped process
%g real GID of dumped process
%s number of signal causing dump
%t time of dump (secs since 0:00h, 1 Jan 1970)
%h hostname (same as the nodenamereturned by uname(2))
%e executable filename
If you choose to enable it (because let's say you might have applications crashing and you want to see an image of the application's process memory at the time of termination) and control the name of the core file generated you need to edit /proc/sys/kernel/core_pattern. The default value in this file is "core", which means that core files will be dumped in the working directory and the filename is core. If you want to change this pattern and dump the core files in /tmp direcory and also append the process ID to the file name do the following (be aware that this is a system wide settting):
echo /tmp/core%p > /proc/sys/kernel/core_pattern
or
sysctl -w kernel.core_pattern=/tmp/core%p
If you choose to make the change persistent after reboot edit the /etc/sysctl.conf file and add:
kernel.core_pattern=/tmp/core%p
To enable the change made to the /etc/sysctl.conf file runsysctl -p /etc/sysctl.conf
Core file name patterns can use the following % specifiers:%% A single % character
%p PID of dumped process
%u real UID of dumped process
%g real GID of dumped process
%s number of signal causing dump
%t time of dump (secs since 0:00h, 1 Jan 1970)
%h hostname (same as the nodenamereturned by uname(2))
%e executable filename
No comments:
Post a Comment