1830241 Members
1737 Online
109999 Solutions
New Discussion

redirect core file

 
QUIRICONI
Occasional Advisor

redirect core file

Hi all,

I would like to know how I can redirect a core file ??
In fact a huge core is generated under a folder that is too small... I want to generate it under an another folder...

I've tried to do a ln -s /other_folder core
but the core is not generated in this case..

Have you got some ideas ??

Regards,
Jean-Remi.
10 REPLIES 10
Robert-Jan Goossens
Honored Contributor

Re: redirect core file

Hi Jean-Remi,

How about linking it to /dev/null.

# ln -s /dev/null core

Hope it helps,

Robert-Jan.
RAC_1
Honored Contributor

Re: redirect core file

ln -s will do the trick.

ln -s /dev/null core.

ln -s /other_file core.
There is no substitute to HARDWORK
Kent Ostby
Honored Contributor

Re: redirect core file

If you just want to avoid having it created,
then you can create a subdirectory in the directory where the core files show up and call it "core" then there will be no core created at all.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
H.Merijn Brand (procura
Honored Contributor

Re: redirect core file

If you do not need the full core dump, you can use 'limit' to - well - limit the core size. Sometimes the start will do

# limit
cputime 0:0-1
filesize 4194303 kbytes
datasize 262144 kbytes
stacksize 8192 kbytes
coredumpsize 2097151 kbytes
memoryuse 4194303 kbytes
descriptors 60
#

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
doug mielke
Respected Contributor

Re: redirect core file

I think cores by default are generated in the current directory. If you call the offending program from a larger directory, would the core be placed there?
Jeff Schussele
Honored Contributor

Re: redirect core file

Hi Jean-Remi,

Core files are created in the process present working directory, so you have two options:

1) Move to a larger dir before starting the process:
cd /other/larger/dir
/path/to_your/process

2) Explicitly set the $PWD var before starting
export PWD=/other/larger/dir
/path/to_your/process

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
QUIRICONI
Occasional Advisor

Re: redirect core file

Well,

I've tried the command:

[HP-UX]:/tmp>ln -s /folder core

[HP-UX]:/tmp> ll
core -> ./folder
core_cprog.c
core_prog

But the core is not generated at all.
I need this entire core to analyse it and I need to redirect it in an another folder...
RAC_1
Honored Contributor

Re: redirect core file

What are permissions on /folder file. The user who runs this program should be able to access /folder file.


There is no substitute to HARDWORK
Mark Grant
Honored Contributor

Re: redirect core file

Kents reply above shows us that a core file will not be created if you have linked "core" to a folder. Unless you have a typo in your post, this is exactly what you have done :) Therefore, no core.

You should have tried "ln -s /foder/core core"

Never preceed any demonstration with anything more predictive than "watch this"
QUIRICONI
Occasional Advisor

Re: redirect core file

ok,

ln -s /folder/core core

it works properly.

Thank you all,
Jean-R??mi.