Operating System - HP-UX
1753354 Members
5059 Online
108792 Solutions
New Discussion юеВ

Where can I place ulimit -c 0?

 
Douglas P. Van Tol, Jr.
Occasional Contributor

Where can I place ulimit -c 0?

I was wondering where I can place the ulimit -c 0 statement on the system, such that all user application started either locally or remotely will create 0 size core files??

I'm having trouble placing this command in the proper place currently, as the applications that create the core files are started from remote processes, whose parents are removed post-startup.

I was also wondering if this is a bourne or ksh only statement, as the applications that we are starting are done through csh?

Thanks in advance,

Doug
4 REPLIES 4
Douglas P. Van Tol, Jr.
Occasional Contributor

Re: Where can I place ulimit -c 0?

foolish me!! after I reread my previous post I answered my own question on setting this up in csh.

But, I'm still wondering which file(s) I can place this in so it is applied system-wide.

Doug
James R. Ferguson
Acclaimed Contributor

Re: Where can I place ulimit -c 0?

Doug:

For the csh it's 'limit'. For the Posix shell it's 'ulimit'. See man 'sh-posix'.

One easy solution is to create a file in your directory called 'core' that allows only read access to all users. Do:

# touch core
# chmod 444 core

Now when a program aborts that would create a core file in that directory it will not create the file because it cannot overwrite the existing one.

...JRF...
Andreas Voss
Honored Contributor

Re: Where can I place ulimit -c 0?

Hi,

fop system wide setting edit:
/etc/csh.login # for C shell
/etc/profile # for bourne/posix/korn shell

Regards
Bill Hassell
Honored Contributor

Re: Where can I place ulimit -c 0?

ksh does not have the full ulimit implementation, so in /etc/profile, you'll need to test for -sh as $0 (the executing process name). Type ulimit -a to see the POSIX shell's list of choices. /etc/profile might look like this:

if [ "$0" = "-sh" ]
then
ulimit -c 0
fi

You may have to expand this for other shells that recognize ulimit. The ulimit value extends to the environment of processes started by the parent, even if the parent disappears.

ulimit is a shell built-in to the setrlimit system call, so processes can make this change too.


Bill Hassell, sysadmin