我遇到的问题是,一旦logrotate将当前日志文件移动到新文件中,新创建的日志文件就不再填充日志了.似乎删除原始日志文件后,其文件处理程序将丢失,重定向将不再起作用.
我还发现this post与我有同样的问题,并声称可以通过使用>>来修复它.而不是>重定向输出.我测试了他的解决方案,但它对我不起作用.有谁知道如何保持重定向工作?
解决方法
copytruncate Truncate the original log file 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
原文地址:https://www.jb51.cc/linux/402424.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。