Operating System - HP-UX
1824724 Members
3745 Online
109674 Solutions
New Discussion юеВ

limit the size of core dumps

 
federico_3
Honored Contributor

limit the size of core dumps

We should limit the size of core dumps so that they don't fill up too much disk space (limit to 10 Mb for example).

How can i do ??


Thanks
Federico

10 REPLIES 10
Bruno Vidal
Respected Contributor

Re: limit the size of core dumps

under sh/ksh: "ulimit -c size"
For the other shell, looks at man pages and for ulimit build in command.

Cheers.
federico_3
Honored Contributor

Re: limit the size of core dumps

should i put the command in every .profile file( for every user...)?

Is the size you indicated in MBs or KBs?


Thanks
Federico
Bruno Vidal
Respected Contributor

Re: limit the size of core dumps

Look in man pages:
-c The number of 512-byte blocks in the size of core dumps.

So the easy way, is to add it in the /etc/profile a line like this:

ulimit -c 20480

It will limit core files to 10Mb.

Cheers.
Zeev Schultz
Honored Contributor

Re: limit the size of core dumps

All this (ulimit) is ok,but it's per shell session condition (like if you have one user connected or opened more that one shell - he/she would have more than 10mb of core space).I don't know actually if it should be a login shell or not.

Zeev
So computers don't think yet. At least not chess computers. - Seymour Cray
Bruno Vidal
Respected Contributor

Re: limit the size of core dumps

Okay, if the purpose is to limit the overall size of core on a system, I don't see any solution, because an application is core dumping in his directory, and it is not possible to indicate to a process where doing the core. So the only solution can also to avoid the creation of any core by setting a null size for every user. By default any core are not usable because no application are compiled with -g or any debugging option. If a developper need the core file, it is still possible to change with ulimit.

Cheers.
Michael Steele_2
Honored Contributor

Re: limit the size of core dumps

'ulimit' is a ksh specific command, for csh I believe its 'limit'. Note these threads:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xe0086d96588ad4118fef0090279cd0f9,00.html

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xe51272106351d5118fef0090279cd0f9,00.html

Regarding "...should i put the command in every .profile file...."

Every user goes through /etc/profile. Additions in this file can be made here for all users, just parse out the shell.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x3de0f841489fd4118fef0090279cd0f9,00.html
Support Fatherhood - Stop Family Law
Pete Randall
Outstanding Contributor

Re: limit the size of core dumps

How about removing the core files rather than limiting their size? I use find to search them out and remove them if they're older than a couple of days. That way, if a developer is actually using one for debugging purposes, he'll have the whole thing available to him instead of just a truncated version.


Pete

Pete
federico_3
Honored Contributor

Re: limit the size of core dumps

I set the command "ulimit -c 20480 " in the /etc/profile script and when I logon in the system I get the error" ulimit"bad option"... How come???
Umapathy S
Honored Contributor

Re: limit the size of core dumps

hi Federico,
Just ulimit will do in ksh for both 11 and 10.2.

$ulimit 20480

If the core size exceeds the limit, it will dump as much as allowed by the ulimit.

HTH
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Michael Steele_2
Honored Contributor

Re: limit the size of core dumps

Regarding "...I set the command "ulimit -c 20480 " in the /etc/profile script and when I logon in the system I get the error" ulimit"bad option"..."

Sounds like a shell mismatch. Posix vs. ksh.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x8f106049dbb6d611abdb0090277a778c,00.html

Test for the shell:

echo $SHELL
/usr/bin/sh (* Posix *)
echo $SHELL
/usr/bin/ksh (* ksh *)

If you're having trouble determining where to put the logic in /etc/profile then use 'set -xv' to debug.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xbcbf68da2286d711abdc0090277a778c,00.html
Support Fatherhood - Stop Family Law