Chinaunix首页 | 论坛 | 博客
  • 博客访问: 476258
  • 博文数量: 111
  • 博客积分: 2332
  • 博客等级: 大尉
  • 技术积分: 1187
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-29 11:22
文章分类

全部博文(111)

文章存档

2013年(9)

2012年(28)

2011年(17)

2010年(28)

2009年(29)

我的朋友

分类: LINUX

2012-09-10 14:47:45

转自:
 
Enable coredumps in daemon start script

In the daemon startup script (/etc/init.d/mydaemon) add the following line before the definition of the "start()" method:

  1. DAEMON_COREFILE_LIMIT="unlimited"

Enable coredumps globally

Edit the /etc/profile configuration file. Search for existing ulimit -c commands and replace with:

  1. # Enable core files by default
  2. ulimit -c unlimited > /dev/null 2>&1

 Allow setuid programs to dump core
# The suid_dumpable control file is found in different places ...

  1. if [ -e /proc/sys/kernel/suid_dumpable ]; then
  2. echo 1 > /proc/sys/kernel/suid_dumpable
  3. else
  4. echo 1 > /proc/sys/fs/suid_dumpable
  5. fi
 
Changing coredump location

  1. echo /var/tmp/core > /proc/sys/kernel/core_pattern
Make above changes persistent after reboot

Add the following entries to /etc/sysctl.conf:

  1. # Allow suid programs to dump core
  2. fs.suid_dumpable = 1
  3. # Dump core in /var/tmp
  4. kernel.core_pattern = /var/tmp/core
Testing coredumps
Send the process the SIGABRT signal, it should abort and dump core:


  1. kill -ABRT
阅读(803) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~