postrotate脚本后的linux – logrotate压缩文件

我有一个应用程序每天生成一个非常重的大日志文件(每天约800MB),因此我需要压缩它们,但由于压缩需要时间,我希望在将HUP信号重新加载/发送到应用程序后,该logrotate压缩该文件.
/var/log/myapp.log {
    rotate 7
    size 500M
    compress
    weekly
    postrotate
        /bin/kill -HUP `cat /var/run/myapp.pid 2>/dev/null` 2>/dev/null || true
    endscript
}

压缩发生在后旋后(已经是反直觉的)了吗?
如果没有任何人可以告诉我,如果可以这样做没有额外的命令脚本(一个选项或一些技巧)?

谢谢
托马斯

解决方法

后转脚本在压缩发生之前运行:从 logrotate的手册页

The next section of the config files defined how to handle the log file
/var/log/messages. The log will go through five weekly rotations before
being removed. After the log file has been rotated (but before the old
version of the log has been compressed),the command /sbin/killall -HUP
syslogd will be executed.

无论如何,您可以使用delaycompress选项将压缩推迟到下一轮.

相关文章

在Linux上编写运行C语言程序,经常会遇到程序崩溃、卡死等异...
git使用小结很多人可能和我一样,起初对git是一无所知的。我...
1. 操作系统环境、安装包准备 宿主机:Max OSX 10.10.5 虚拟...
因为业务系统需求,需要对web服务作nginx代理,在不断的尝试...
Linux模块机制浅析 Linux允许用户通过插入模块,实现干预内核...
一、Hadoop HA的Web页面访问 Hadoop开启HA后,会同时存在两个...