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.

Is there a way to change the core filename format per session instead of for the entire machine?
On Linux the only way I can find is using sysctl as root:

sudo /sbin/sysctl -w "kernel.core_pattern=core-%H-%N-%P"

On Solaris same problem with root

coreadm -g core-%n-%f-%p

But unfortunately both these commands change the system permanently for all users, which I wish to avoid.

What I want is to be able to put a command in my .bashrc and as a non priv user have my core files be placed and named where I want them.

EDIT:

Just found out you can do this in solaris with

coreadm -p core-%n-%f-%p $$

Does anyone know about Linux?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

On Linux, as far as I can tell, the core file name pattern is a global kernel setting.

The core file name is determined by format_corename in fs/exec.c. It is computed from the corename variable, which is set only through the kernel.core_pattern sysctl.

But maybe the behavior you want can be obtained by setting the core pattern to |/path/to/foo %h %p, which causes the core file contents to be piped into the /path/to/foo executable. Note that what follows the pipe is split into words at spaces.

share|improve this answer
    
Did the |/path/to/foo %h %p thing work? –  Brian Vandenberg May 2 at 18:21

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.