如何在 LAMP 服务器命令行中为我的 codeigniter 应用程序创建新的日志轮换文件。我想运行这个日常流程
日志文件是这样的
application/logs/log-2013-06-12.php
application/logs/log-2013-06-13.php
application/logs/log-2013-06-14.php
application/logs/log-2013-06-15.php
这是我的日志轮换脚本,如果有任何错误请告诉我
/var/www/my-app/application/logs/*.php{
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 640 root password
sharedscripts
dateext
dateformat -web01-%Y-%m-%d-%s
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}
最佳答案
您创建的配置文件没有问题。 Logrotate 实用程序仅提供检查机制。
有 /etc/cron.daily/logrotate
文件每天调用 logrotate。
出于测试目的,您可以添加您的 cron 分钟规则并放入 logrotate 的配置文件 根据该规则。
关于linux - 如何在 Linux 中创建 logrotate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17402464/