[erlang-questions] os:cmd/1 does not work for ulimit -n

Jachym Holecek <>
Thu May 14 12:04:27 CEST 2009


# MAthuvathanan Mou. 2009-05-14:
> Using Linux (RedHat) I wanted to increase number of open files for that
> session only (temporarily)
> 
> In the erl shell I did
> 
> erl
> Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
> [kernel-poll:false]
> 
> Eshell V5.5.5  (abort with ^G)
> 1> os:cmd('ulimit -n').
> "1024\n"
> 2> os:cmd('ulimit -n 2048').
> []
> 3> os:cmd('ulimit -n').
> "1024\n"
> 4>
> 
> Why did open file not increase here?

This increases the limit for the temporary shell process that is
forked to handle the command. It doesn't affect parent beam process.

Here's how to do increase the limit for beam:

  $ (ulimit -n 66 && exec erl)
  Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [async-threads:0] [hipe] [kernel-poll:false]

  Eshell V5.6.3  (abort with ^G)
  1> os:cmd("ulimit -n").
  "66\n"
  2> halt().

HTH,
	-- Jachym



More information about the erlang-questions mailing list