logrotate 里面应该使用copytruncate

1. 参考http://unix.stackexchange.com/questions/33447/why-we-should-use-create-and-copytruncate-together

copytruncate

Truncate the original log file to zero size in place after creating a copy, instead of moving the old log file and optionally creating a new one. It can be used when some program cannot be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the create option will have no effect, as the old log file stays in place.

2. 原来产品里面使用的是 使用命令压缩备份文件(mv a.out a.out.1; gzip a.out),然后重启进程。如果进程重启不成功,会导致原来的log文件会仍被原有进程使用,并不断增长,最终导致磁盘空间不足。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值