linux - 每分钟超过大小限制时删除日志文件。 Crontab/Logrotate

标签 linux ubuntu cron logrotate log-rotation

目前它会删除所有以 laravel-*.log 开头的日志文件,而不是那些大于 100MB 的日志文件。我的 logrotate 版本是 3.8.7。

我的定时任务:

*/1 * * * * root logrotate -f /etc/logrotate.d/laravel.conf

laravel.conf:

/var/www/html/project/storage/logs/laravel-*.log {
        su root adm
        rotate 0
        size 100M
}

最佳答案

通过删除 -f 修复了它。当然,现在它不会忽略我的要求。

关于linux - 每分钟超过大小限制时删除日志文件。 Crontab/Logrotate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43388486/

相关文章:

linux - ubuntu bash脚本备份/home/$user但保留最新的

ubuntu - Control-f 不适用于 mac vmware fusion 中 ubuntu 上的 sublime 文本

linux - 我尝试在linux上通过crontab调度任务,但出现错误

Python 脚本在 crontab 下不起作用

linux - 如何在 Obnam 中使用 'root = '?

linux - Windows Home Server 之类的 Ubuntu 远程备份软件

c++ - 如何从 char[] 获取值

php - 创建 Linux Screen session 并获取其 PID

php - "Fatal error: Class ' Memcached ' not found"尝试在 Ubuntu 中安装 Memcache 时

bash - 计划执行返回错误值的 shell 脚本(使用 cron 计划执行脚本)(Ubuntu 20.04.4 LTS)