📌  相关文章
📜  用于设置最大日志文件大小的 shell 脚本 (laravel) - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:37.887000             🧑  作者: Mango

代码示例1
!#/bin/bash

file = /home/user/myapp.com/storage/logs/laravel.log # log file path
maxSize = 2048 #2MB - size in kilobytes
fileSize = $(du -k "$file" | cut -f 1)

if [ $fileSize -ge $maxSize]; then
    echo "" > $file
fi