Make the following modifications to enable core dumps for daemons:
vi /etc/profile
ulimit -S -c 0 > /dev/null 2>&1
with this line:
ulimit -c unlimited >/dev/null 2>&1
DAEMON_COREFILE_LIMIT='unlimited'
echo 2 > /proc/sys/fs/suid_dumpable
echo 1 > /proc/sys/fs/suid_dumpable
echo 2 > /proc/sys/kernel/suid_dumpable
echo 1 > /proc/sys/kernel/core_setuid_ok
fs.suid_dumpable = 2 # RHEL 5 only kernel.suid_dumpable = 2 # RHEL 4 only kernel.core_setuid_ok = 1 # RHEL 3 only kernel.core_pattern = /tmp/core
sysctl -p
When the daemon terminates abnormally, a core file should appear in the configured location, /tmp. The exact location and name of the core file can be controlled through the kernel.core_pattern sysctl, which is documented in the core(5) manual page and /usr/share/doc/kernel-doc*/Documentation/sysctl/kernel.txt from the kernel-doc package.