`
raojl
  • 浏览: 209596 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Controlling core files (Linux)

阅读更多

Controlling core files (Linux)

core file文件重定位:echo /tmp/core.%e.%p > /proc/sys/kernel/core_pattern

 

Core files get created when a program misbehaves due to a bug, or a violation of the cpu or memory protection mechanisms. The operating system kills the program and creates the core file.

If you don't want core files at all, set "ulimit -c 0" in your startup files. That's the default on many systems; in /etc/profile you may find 



 
ulimit -S -c 0 > /dev/null 2>&1 
 

If you DO want core files, you need to reset that in your own .bash_profile:

 
ulimit -c 50000 
 



would allow core files but limit them to 50,000 bytes.

You have more control of core files in /proc/sys/kernel/

For example, you can do eliminate the tagged on pid by

 
echo "0" > /proc/sys/kernel/core_uses_pid 
 



Core files will then just be named "core". People do things like that so that a user can choose to put a non-writable file named "core" in directories where they don't want to generate core dumps. That could be a directory (mkdir core) or a file (touch core;chmod 000 core). I've seen it suggested that a symlink named core would redirect the dump to wherever it pointed, but I found that didn't work.

But perhaps more interesting is that you can do: 

mkdir /tmp/corefiles 
chmod 777 /tmp/corefiles 
echo "/tmp/corefiles/core" > /proc/sys/kernel/core_pattern 
 

All corefiles then get tossed to /tmp/corefiles (don't change core_uses_pid if you do this).

Test this with a simple script:

 
# script that dumps core 
kill -s SIGSEGV $$ 

 

分享到:
评论

相关推荐

    Linux Pocket Guide, 3rd Edition

    The third edition features new commands for processing image files and audio files, running and killing programs, reading and modifying the system clipboard, and manipulating PDF files, as well as ...

    Linux Shell Scripting Cookbook.epub

    It guides you on implementing some of the most common commands in Linux with recipes that handle any of the operations or properties related with files like searching and mining inside a file with ...

    Linux Shell Scripting Cookbook.mobi

    It guides you on implementing some of the most common commands in Linux with recipes that handle any of the operations or properties related with files like searching and mining inside a file with ...

    RHCSA8课堂笔记-RH124

    7. Controlling Access to Files 8. Monitoring and Managing Linux Processes 9. Controlling Services and Daemons 10. Configuring and Securing SSH 11. Analyzing and Storing Logs 12. Managing ...

    user model linux.doc。该文件是The UML Book的电子版,是word版本。

     Centrally managing User Mode Linux instances, and controlling their hardware resources  Implementing clusters and other specialized configurations  Setting up User Mode Linux servers, step-by...

    Controlling Queue Delay

    路由器配备很大的入站缓冲区,以便不惜一切代价避免丢包...为了解决这个问题,有人提出了新的CoDel主动队列管理算法,且已经在Linux内核3.5以上版本中实现。ACM的这篇论文《Controlling Queue Delay》有详细的介绍。

    Mastering Linux Security and Hardening

    controlling special permissions, encrypting file systems, and much moreMaster the art of securing a Linux environment with this end-to-end practical guideBook Description This book has extensive ...

    SAP ERP Financial Accounting and Controlling-Configuration and Use Management

    In this introduction, I explain the meaning of the acronym SAP, the origin of SAP, and the concept of SAP implementation. We will go further to look at Enterprise Resource Plan

    Controlling mechanical systems with backlash

    ### 控制具有回差的机械系统 #### 回差的概念及其影响 回差(backlash)是机械系统中一个重要的非线性因素,它限制了速度和位置控制的性能,在工业、机器人技术、汽车制造、自动化以及其他应用领域都有显著的影响...

    Wiley.Publishing.Fedora.Linux.Toolbox.1000+.Commands.for.Fedora.CentOS.and.Red.Hat.Power.Users.and.Red.Hat.Power.Users.2008.pdf

    - **Managing Processes**: Killing, restarting, and controlling processes using `kill`, `killall`, and `nice`. #### Chapter 10: Managing the System This chapter covers advanced system management tasks...

    7011-financial accounting and controlling

    【7011财务会计与控制】:这个主题主要涵盖了企业内部的财务管理和生产计划方面的内容,特别是关于Master Production Scheduling (MPS)和Material Requirements Planning (MRP)的运用。 MPS,即主生产排程,是企业...

    Controlling-Profitability Analysis with SAP

    标题:“Controlling-Profitability Analysis with SAP”表明这本书是一本关于如何使用SAP软件系统来进行成本控制和盈利能力分析的专业书籍。成本控制和盈利能力分析是企业财务管理中的重要环节,对于企业来说,通过...

    Workflow Based Invoice Controlling for SAP R3

    Workflow based invoice controlling for SAP R/3

    嵌入式linux下基于libusb的USB驱动开发.pdf

    The libusb library provides a unified API for accessing and controlling USB devices, making it easier for developers to develop USB drivers. By using the libusb library, developers can focus on the ...

    Linux C函数详解

    - **守护进程**:编写后台运行的程序,detach from controlling terminal。 - **系统日志**:使用syslog函数记录应用程序日志。 - **性能监控**:使用getrusage、clock_gettime等获取系统资源使用情况。 6. **...

    Beginning Ubuntu Linux Part1

    It’s in these chapters that you’ll really master controlling Linux! Part 5 covers multimedia functions built into Ubuntu, which let you watch movies and play back music. We also take a look at the ...

    Beginning Ubuntu Linux Part2

    It’s in these chapters that you’ll really master controlling Linux! Part 5 covers multimedia functions built into Ubuntu, which let you watch movies and play back music. We also take a look at the ...

    Linux System Administrator Guide Version0.9

    - **Access Control**: Explains mechanisms for controlling user access. - **Shell Startup**: Describes shell startup processes and scripts. #### Managing User Accounts The guide provides instructions...

Global site tag (gtag.js) - Google Analytics