[comp.unix.questions] How to set ulimit in SysV

jc@minya.UUCP (jc) (10/05/87)

> >As for the original problem, can't superuser set the ligit up as
> >well as down?
> 
> That IS the original problem!  ONLY the super-user can get around
> the ridiculously small initial ulimit coded into the kernel!

OK, I decided to see how hard this one was; it took 15 minutes, of which
13 were due to a bug in init....

What you do is change your inittab entries for getty to:

	t3:2:respawn:/bin/sh /etc/Getty tty03 tty03

The /etc/Getty script looks like:

	ulimit 8000 # or whatever you like.
	exec /etc/getty $*

The bug in init is that the "/bin/sh " is required; init refused to run
a shell script directly.  [Grumble; the toikeys; grumble; wasting 13 
minutes of my time; grumble; had to go to 2nd terminal to recover when
the first one went zombie; grumble... :-]

There, wasn't that easy?

-- 
	John Chambers <{adelie,ima,maynard}!minya!{jc,root}> (617/484-6393)

jal@oliveb.UUCP (Benjamin G. Golding) (10/06/87)

In article <275@minya.UUCP>, jc@minya.UUCP (jc) writes:
> OK, I decided to see how hard this one was; it took 15 minutes, of which
> 13 were due to a bug in init....
> 
> What you do is change your inittab entries for getty to:
> 
> 	t3:2:respawn:/bin/sh /etc/Getty tty03 tty03

No.  This does not alter the ulimit for processes like cron and the
jobs that it starts up.

This really is terribly broken and a major oversight by AT+T.  I have
had trouble with this in a numer of different ways, such as
accidentally setting it to -1 and not being able to login because
/etc/login can't write /etc/utmp!  Can you believe they made it
signed?!  At least it's configurable in rel 3.1, though silly that you
can't turn it off.

	Ben Golding.
-- 
"Holy oleo, Batman!!"
"Why Boy Wonder; I didn't know you could yodel!"

emigh@ncsugn.ncsu.edu (Ted H. Emigh) (10/12/87)

In article <275@minya.UUCP> jc@minya.UUCP (jc) writes:
>> >As for the original problem, can't superuser set the ligit up as
>> >well as down?
>> 
>> That IS the original problem!  ONLY the super-user can get around
>> the ridiculously small initial ulimit coded into the kernel!
>
>What you do is change your inittab entries for getty to:
>
>	t3:2:respawn:/bin/sh /etc/Getty tty03 tty03
>
>The /etc/Getty script looks like:
>
>	ulimit 8000 # or whatever you like.
>	exec /etc/getty $*
>
ncsugn has been using the following program for some 5 months -- the
original came from the net from some person at AT&T.  ncsugn is a 3B2/400
running SVR3.0.

/*
	Change the file size limit

Compile this and put it in place of the usual init program:

cc ulimit.init.c -o ulimit.init
mv /etc/init /etc/real.init
mv ulimit.init /etc/init
chmod 754 /etc/init               <-- Same as the old init

The next time the machine is booted, the ulimit will be changed.

*/
main(argc, argv)
int argc;
char *argv[];
{

	ulimit(2, 32768L);	/* "2" sets ulimit.  32768 = 16Mb. */

	execv("/etc/real.init", argv);
}

--------------------

-- 
Ted H. Emigh, Dept. Genetics and Statistics, NCSU, Raleigh, NC
uucp:	mcnc!ncsuvx!ncsugn!emigh	internet:  emigh%ncsugn.ncsu.edu
BITNET: NEMIGH@TUCC                  @ncsuvx.ncsu.edu:emigh@ncsugn.ncsu.edu

tel@moby.UUCP (Tom Lowe) (10/12/87)

In article <6497@oliveb.UUCP>, jal@oliveb.UUCP (Benjamin G. Golding) writes:
> In article <275@minya.UUCP>, jc@minya.UUCP (jc) writes:
> > OK, I decided to see how hard this one was; it took 15 minutes, of which
> > 13 were due to a bug in init....
> > 
> > What you do is change your inittab entries for getty to:
> > 
> > 	t3:2:respawn:/bin/sh /etc/Getty tty03 tty03
> 
> No.  This does not alter the ulimit for processes like cron and the
> jobs that it starts up.
> 
Very true unfortunately.......

Workaround:

in /etc/rc.d/cron add the line   'ulimit 40960' or whatever number
before the line '/etc/cron'

This same thing works for any shell script in rc.d that needs a 
larger ulimit.

For people who don't know what /etc/rc.d is, that's is a directory
that contains shell scripts that are executed every time the system
is taking to init run level 2  (look in /etc/rc2 to see how this
is done).

-- 
Tom Lowe {rutgers,gatech,huscb,burdvax,ihnp4,cbosgd}!psuvax1!moby!tel
AT&T National Systems Support Center, S. Plainfield, NJ  (1-800-922-0354)
  Please call only if you have an AT&T computer under Warranty or if you
  have an AT&T Maintenance Contract on your equipment.