Find the answer to your Linux question:
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....
  1. #1
    Just 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.

  2. #2
    Linux Guru
    Join Date
    May 2011
    Posts
    1,842
    does this not work?
    Code:
    #!/bin/sh
    ulimit -c unlimited

  3. #3
    Linux Guru Rubberman's Avatar
    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:
    Code:
    ulimit -c unlimited
    Sourcing it is just as if you typed it in.

    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!

  4. #4
    Linux Guru
    Join Date
    May 2011
    Posts
    1,842
    yes, i assumed the value was only needed inside said script.

  5. #5
    Just Joined!
    Join Date
    Nov 2006
    Location
    Hyderabad
    Posts
    85
    I placed it in /etc/profile and it is working now
    thank you

  6. #6
    Linux Newbie glene77is's Avatar
    Join Date
    Dec 2009
    Location
    Memphis, TN
    Posts
    114
    Raj,
    Now, you have my curiosity up.
    From "man ulimit" I read the following :
    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%
    What catches my eye is :
    " 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...