加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

macos – ulimit第一次调用ok第二次调用失败,为什么?

发布时间:2020-12-13 23:01:38 所属栏目:Linux 来源:网络整理
导读:在macosx 10.7上,使用bash 第一次调用ulimit -n成功,而第二次调用失败. a:$ulimit -n 2560a:$ulimit -n 5000a:$ulimit -n 5000a:$ulimit -n 6000bash: ulimit: open files: cannot modify limit: Operation not permitted 但是,如果我尝试使用新的shell(或其
在macosx 10.7上,使用bash

第一次调用ulimit -n成功,而第二次调用失败.

a:$ulimit -n 
2560
a:$ulimit -n 5000
a:$ulimit -n 
5000
a:$ulimit -n 6000
bash: ulimit: open files: cannot modify limit: Operation not permitted

但是,如果我尝试使用新的shell(或其他shell)ulimit -n 6000,它会成功:

a:$ulimit -n 
2560
a:$ulimit -n 6000
a:$ulimit -n 
6000

这是为什么?

解决方法

从bash手册页:

A hard limit cannot be increased once it is set; a soft limit may be
increased up to the value of the hard limit. If neither -H nor -S is
specified,both the soft and hard limits are set.

大多数现代* NIX实际上不再使用ulimit了.我猜OS X没有ulimit hard max set,所以你的第一个调用设置了soft和hard max,所以你的第二次调用每次都会失败.没有[limit]参数的第一个调用可能是打印soft max.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读