Results 1 to 6 of 6
I am successfully running "ulimit -c unlimited" from command prompt
But how to run it from shell script.
thanks in advance....
- 06-27-2011 #1Just Joined!
- Join Date
- Nov 2006
- Location
- Hyderabad
- Posts
- 85
ulimit
I am successfully running "ulimit -c unlimited" from command prompt
But how to run it from shell script.
thanks in advance.
- 06-27-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,842
does this not work?
Code:#!/bin/sh ulimit -c unlimited
- 06-27-2011 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
ulimit is a shell command and its results are lost when the shell exists, hence the difficulty using it in a shell script. You can use it in a script that is "sourced" from your current session with either the "source" of "." commands. Ie, "source setulimit.sh" where the "setulimit.sh" file looks like this:
Sourcing it is just as if you typed it in.Code:ulimit -c unlimited
Alternatively, you can put the ulimit command inside your ~/.bashrc so that it will always be active when you start a shell in your account.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-27-2011 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,842
yes, i assumed the value was only needed inside said script.
- 06-28-2011 #5Just Joined!
- Join Date
- Nov 2006
- Location
- Hyderabad
- Posts
- 85
I placed it in /etc/profile and it is working now
thank you
- 06-28-2011 #6
Raj,
Now, you have my curiosity up.
From "man ulimit" I read the following :
What catches my eye is :ULIMIT(3) Linux Programmer's Manual ULIMIT(3)
NAME
ulimit - get and set user limits
SYNOPSIS
#include <ulimit.h>
long ulimit(int cmd, long newlimit);
DESCRIPTION
Warning: This routine is obsolete. Use getrlimit(2), setrlimit(2), and
sysconf(3) instead. For the shell command ulimit(), see bash(1).
The ulimit() call will get or set some limit for the calling process.
The cmd argument can have one of the following values.
UL_GETFSIZE
Return the limit on the size of a file, in units of 512 bytes.
UL_SETFSIZE
Set the limit on the size of a file.
Manual page ulimit(3) line 1/52 45%
" Warning: This routine is obsolete. "
So, what is your interest in "ulimit" ?
Sorry, It just occurred to me that you are on an "older" system.
Probably Maintaining code.
glene77is


Reply With Quote