分类: LINUX
2011-03-11 17:10:09
In the daemon startup script (/etc/init.d/mydaemon) add the following line before the definition of the "start()" method:
DAEMON_COREFILE_LIMIT="unlimited"
Edit the /etc/profile configuration file. Search for existing ulimit -c commands and replace with:
# Enable core files by default
ulimit -c unlimited > /dev/null 2>&1
# The suid_dumpable control file is found in different places ...
if [ -e /proc/sys/kernel/suid_dumpable ]; then
echo 1 > /proc/sys/kernel/suid_dumpable
else
echo 1 > /proc/sys/fs/suid_dumpable
fi
echo /var/tmp/core > /proc/sys/kernel/core_pattern
Add the following entries to /etc/sysctl.conf:
# Allow suid programs to dump core
fs.suid_dumpable = 1
# Dump core in /var/tmp
kernel.core_pattern = /var/tmp/core
Send the process the SIGABRT signal, it should abort and dump core:
kill -ABRT