Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to generate core File in Linux

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article shows you how to generate core files in Linux, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Set up the core file temporarily:

1. Check to see if the switch for generating core files is on

Enter the command # ulimit-a

Description: the first line of core file size is 0, not open.

two。 Use # ulimit-c [kbytes] to set the size of core files allowed to be generated by the system

Ulimit-c 0 does not generate core files

Ulimit-c 100 sets the maximum core file to 100k

Ulimit-c unlimited does not limit core file size

Execute the command # ulimit-c unlimited, then ulimit-a view the core

The core file can be generated when the database process crashes, and this method only works in shell.

Permanently set up the core file:

1. Modify / etc/profile file add parameters

Vim / etc/profile

Add ulimit-c unlimited to the profile file

Save exit, restart the server, change the file for a long time, or # source / etc/profile, do not restart the server, use source to make the file effective immediately.

two。 Specify the path and name of the generated file

Execute # vim / etc/sysctl.conf, enter edit mode, and add the following two lines

Kernel.core_pattern=/var/core/core_%e_%p

Kernel.core_uses_pid=0

Create the core directory under var with # sysctl-p / etc/sysctl.conf, and the changes will take effect immediately.

The naming parameters of core_pattern are as follows:

% c maximum size of the dump file

E the file name of the dump

G the actual group ID of the process of the dump

% h hostname

% p process PID of dump

S caused the signal of this coredump

T dump time (seconds since January 1, 1970)

% u actual user ID of the dump process

3. Test result

# kill-s SIGSEGV $$, execute the command, you can see that a core file has been generated under / var/core, indicating that the setting has been successful.

At this point, if something goes wrong with the process, you can debug it with the core file.

The above is how to generate core files in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report