Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #shell #script #set #max #size #log #file
ADD COMMENT
Topic
Name
1+7 =