linux - How to change core pattern only for a particular application? -
my application requires core file generated in specific pattern.
how do without affecting other processes?
and how do when /proc read-only?
man core
tells us:
piping core dumps program
since kernel 2.6.19, linux supports alternate syntax
/proc/sys/kernel/core_pattern
file. if first character of file pipe symbol (|
), remainder of line interpreted program executed. instead of being written disk file, core dump given standard input program.note following points:
the program must specified using absolute pathname (or pathname relative root directory, /), , must follow '|' character.
the process created run program runs user , group root.
command-line arguments can supplied program (since linux 2.6.24), delimited white space (up total line length of 128 bytes).
the command-line arguments can include of % specifiers listed above. example, pass pid of process being dumped, specify %p in argument.
you can put script there, e.g.
| /path/to/myscript %p %s %c
you can detect process triggering coredump: (man core
):
%% single % character %p pid of dumped process %u (numeric) real uid of dumped process %g (numeric) real gid of dumped process %s number of signal causing dump %t time of dump, expressed seconds since epoch, 1970-01-01 00:00:00 +0000 (utc) %h hostname (same nodename returned uname(2)) %e executable filename (without path prefix) %e pathname of executable, slashes ('/') replaced exclama‐ tion marks ('!'). %c core file size soft resource limit of crashing process (since linux 2.6.24)
now have "do default thing" other processes own
Comments
Post a Comment