|
Helping ordinary people create extraordinary websites! |
Controlling Core Files (Linux)By Tony Lawrence2005-05-12
Controlling Core Files (Linux) 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 50000would 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_pidCore 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/corefilesAll 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 coreBut wait, there's more (if your kernel is new enough). From "man proc": /proc/sys/kernel/core_patternIf you are running a Linux kernel that doesn't support this, you'll get no core files at all, which is also what happens if the directory in core_pattern doesn't exist or isn't writable by the user dumping core. So that's yet another way to not dump core for certain users: set core_pattern to a directory that they can't write to, and give write permission to the users who you do want to create core files. Tutorial Pages: » Controlling Core Files (Linux) © Copyright 2005 A.P. Lawrence
|
|