Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running CentOS 5.5 and working on server application that sometimes I need to force core dump so I can see what is going on. If I start my server from shell and send kill SIGABRT, a core file is created. If I start same program from crontab and then I send the same signal to it the server is "killed" but no core file is generated. Does any one know why is that and what need to be added to my code or changed in system settings to allow core file generation?

Just a side note
I have ulimit set to unlimited in /etc/profile

I have set

  • kernel.core_uses_pid = 1
  • kernel.core_pattern=/var/cores/%h-%e-%p.core

in /etc/sysctl.conf

Also my server app was added to crontab under same login id as I am running it from shell.

Any help greatly appreciated

share|improve this question
add comment

1 Answer

The current working directory for a cron job may be different than the one you expect. Try doing cd /some/writeable/dir && yourdaemon in your crontab entry. Also, you should normally run deamons using init or Upstart or similar. See Process Management.

From man 5 core:

There are various circumstances in which a core dump file is not pro‐ duced:

  • The process does not have permission to write the core file. (By default the core file is called core, and is created in the current working directory. See below for details on naming.) Writing the core file will fail if the directory in which it is to be created is non-writable, or if a file with the same name exists and is not writable or is not a regular file (e.g., it is a directory or a sym‐ bolic link).

  • A (writable, regular) file with the same name as would be used for the core dump already exists, but there is more than one hard link to that file.

  • The file system where the core dump file would be created is full; or has run out of inodes; or is mounted read-only; or the user has reached their quota for the file system.

  • The directory in which the core dump file is to be created does not exist.

  • The RLIMIT_CORE (core file size) or RLIMIT_FSIZE (file size) resource limits for the process are set to zero; see getrlimit(2) and the documentation of the shell's ulimit command (limit in csh(1)).

  • The binary being executed by the process does not have read permission enabled.

  • The process is executing a set-user-ID (set-group-ID) program that is owned by a user (group) other than the real user (group) ID of the process. (However, see the description of the prctl(2) PR_SET_DUMPABLE operation, and the description of the /proc/sys/fs/suid_dumpable file in proc(5).)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.