Linux Core file Settings

Source: Internet
Author: User

http://blog.csdn.net/ctthuangcheng/article/details/8963551Linux core file SettingsCategory: Linux OS debugging Technique2013-05-23 09:51 1446 people read comments (0) favorite reports

In Linux, typically when a process exits abnormally, a core file is generated, which is a dump file of memory when the process is suddenly dead, also known as Core dump.

See how Linux scripts are parsed:

Echo

1. Verify that the core is open

Log in as See/see

Csh:limit; Coredumpsize = 0, indicating that the core is not open, otherwise open.

Bash:ulimit–a; Focus on the Red section. If it is 0, the core does not open, otherwise it opens.

2. Turn on core, set size

If not turned on, permanently open

······ Log in with Root/huawei user, vi/etc/security/limits.conf, note the red part

Soft < hard size

Temporarily specify the size to See/see user login,

Csh:limit coredumpsize 4096000

Bash:ulimit-c 4096000 Size Less than the size set in/etc/security/limits.conf

Note: These are temporary, and once the active window is closed and opened again, the core size is set to expire.

3. Core path Configuration

Note: The specified core path has write permissions

Log in as See/see user,/sbin/sysctl-a |grep core to see the path of the current core file generation

Then check with the naked eye what the two configuration values are for Kernel.core_pattern and kernel.core_uses_pid.

Kernel.core_pattern:core file path

Kernel.core_uses_pid: Generate core file, suffix with pid 1: band; 0: Without

Temporarily modify path (requires root permission)

/sbin/sysctl-w kernel.core_pattern=/core/core.%e.%p

/sbin/sysctl-w kernel.core_uses_pid=0

%p–insert pid into filename---show process number

%u–insert current UID into filename---user ID

%g–insert current GID into filename---group ID

%s–insert signal that caused the coredump into the filename---add a signal that causes the core to be generated

%t–insert UNIX time, the coredump occurred into filename---times

%h–insert hostname where the coredump happened into filename---host name

%e–insert coredumping executable name into filename---names

Permanently modify the path (requires root permission, the machine restart will also take effect):

To modify/etc/sysctl.conf, add 2 lines:

Kernel.core_pattern =/core/core.%e.%p

Kernel.core_uses_pid = 0

Settings take effect
Sysctl-p/etc/sysctl.conf

4. Generate core (for self-test)

To See/see users, ksh;kill-11 $$

5. Positioning Analysis Core

GDB Container Core File

Then: BT

6. Close the core

Temporary shutdown:

Csh:limit Coredumpsize 0

Bash:ulimit-c 0

Note: These are temporary, and once the active window is closed and opened again, the core size is set to expire.

Permanently closed:

Log in as Root/huawei user, vi/etc/security/limits.conf, note the red part is 0

Linux Core file Settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.