问题2:CentOS 下修改 core file size 失败解决

目的:修改core file size

1. 查看当前的系统资源限制 ulimit -a

[root@10gr2 ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 16061
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 16061
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

【说明】:core file size          (blocks, -c)  0  这项也就是关于 core file size 的限制的内容现在是0 也就不产生core file size ,现在想将这个值改为2GB

2. 在/etc/security/limits.conf 中加入下列的内容对 core file size 进行限制

* soft   core 4194304
* hard core 4194304

3. 退出当前登陆,重新登陆,通过命令 ulimit -c 进行查看设置是否成功

[root@10gr2 ~]# ulimit -c
0

【说明】:设置只对当前的登陆有效,并不是对每次的登陆都生效,那么说明更改不成功

4. 查找原因,研究了一下相关的文档,有三个因素:

In /etc/profile (Redhat)

# No core files by default
# ulimit -S -c 0 > /dev/null 2>&1

In /etc/init.d/functions (Redhat)

# make sure it doesn't core dump anywhere unless requested

#ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1

这上面两个文件的ulimit 命令注释掉(不然登录后会系统执行一遍又将其改成0)

5. 修改完上面的两项之后,保存,并且退出当前登陆,重新登陆 通过命令 ulimit -c 查看

[root@10gr2 ~]# ulimit -c
4194304

修改成功!

6. 当然,还有第三种情况,就是写到当前用户的bash_profile 里了,同样如果bash_profile 里如果有 ulimit -c 0 的话,也需要去掉,否则用户重新登陆时,都会被置为0

--END--

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值