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?
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
infs/exec.c
. It is computed from thecorename
variable, which is set only through thekernel.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.