Answers for "shell script to set a max size of log file (laravel)"

0

shell script to set a max size of log file (laravel)

!#/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
Posted by: Guest on June-07-2021

Code answers related to "shell script to set a max size of log file (laravel)"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language