LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-07-2008, 09:30 AM   #1
mokku
Member
 
Registered: Feb 2007
Posts: 197

Rep: Reputation: 30
how to setup custom core directory


Hi,

Can we setup custom core directroy? If so, how can I setup? thanhks in advance.
 
Old 04-07-2008, 10:09 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
What do you mean by a core directory?
 
Old 04-07-2008, 10:40 AM   #3
mokku
Member
 
Registered: Feb 2007
Posts: 197

Original Poster
Rep: Reputation: 30
I want to have core files in /home/core directory . How can I configure ?
 
Old 04-07-2008, 11:22 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
As root you can modify the content of /proc/sys/kernel/core_pattern, e.g.
Code:
echo "/path/to/some/dir/core" > /proc/sys/kernel/core_pattern
but previously create a directory somewhere and give permission to the users that will be able to generate core files. The file /proc/sys/kernel/core_pattern usually contains only the pattern of the file name "core" but you can add a full path and according to the proc man page you can put other modifiers. Please note that any modification to the /proc filesystem is lost upon reboot, unless you add an entry in /etc/sysctl.conf, e.g.
Code:
 # Setup a directory to save core files into
kernel.core_pattern = /path/to/some/dir/core
See man proc for details, looking at the description of /proc/sys/kernel/core_pattern.

Last edited by colucix; 04-07-2008 at 11:23 AM.
 
Old 04-07-2008, 11:50 AM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
What distribution and kernel version do you use? You can set the value in /proc/sys/kernel/core_pattern if you have a recent enough kernel. You can tell the current value like this:
Code:
$ cat /proc/sys/kernel/core_pattern
|/usr/share/apport/apport
The output there, using apport is typical on Debian based systems, and is used for the crash handler. Assuming you don't mind losing that functionality, you can just set the value like this (on systems supporting sudo - use root user if your system does not support sudo):
Code:
$ sudo bash -c 'echo "/home/core/core.%u.%p" > /proc/sys/kernel/core_pattern'
There may well be a way to customize the name of the file using apport directly - I am unfamiliar with it, so I'm just telling you how to do it in a way I know.

Anyhow, once you've set that, provided your user's limits are set such that core files are created, core dumps will be put in the /home/core directory with the name "core.%u.%p", where the %u is the UID of the user whose process was dumped, and %p is the PID of the process. For a list of all the different % substitutions, see the core manual page.
 
Old 04-07-2008, 03:05 PM   #6
mokku
Member
 
Registered: Feb 2007
Posts: 197

Original Poster
Rep: Reputation: 30
Thanks a lot guys. It is really helpful.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to update a directory of RPMs for a custom ISO?!?!?! jakev383 Linux - Software 4 04-06-2007 06:42 AM
custom LAMP setup linuxmandrake DamnSmallLinux 1 09-15-2006 02:15 PM
non standard [custom] directory structures ayteebee Linux - Desktop 5 08-17-2006 11:59 AM
Setup custom KVER redbomber2000 Linux - Software 1 06-16-2006 11:18 PM
Linux - Custom Setup dgilmor1 Linux - Newbie 2 07-29-2005 06:53 PM


All times are GMT -5. The time now is 02:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration