logrotate for laravel log

This commit is contained in:
aptalca
2019-07-15 12:22:06 -04:00
parent e735f61e57
commit 1f097316ec
2 changed files with 17 additions and 3 deletions

View File

@@ -2,7 +2,8 @@
# make our folders # make our folders
mkdir -p \ mkdir -p \
/config/www/{backgrounds,icons,avatars,SupportedApps} /config/www/{backgrounds,icons,avatars,SupportedApps} \
/config/log/heimdall
# create symlinks # create symlinks
@@ -12,8 +13,7 @@ symlinks=( \
/var/www/localhost/heimdall/storage/app/public/icons \ /var/www/localhost/heimdall/storage/app/public/icons \
/var/www/localhost/heimdall/app/SupportedApps \ /var/www/localhost/heimdall/app/SupportedApps \
/var/www/localhost/heimdall/database/app.sqlite \ /var/www/localhost/heimdall/database/app.sqlite \
/var/www/localhost/heimdall/.env \ /var/www/localhost/heimdall/.env )
/var/www/localhost/heimdall/storage/logs/laravel.log )
for i in "${symlinks[@]}" for i in "${symlinks[@]}"
do do
@@ -21,6 +21,11 @@ do
[[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i" [[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i"
done done
[[ -e "/var/www/localhost/heimdall/storage/logs/laravel.log" && ! -L "/var/www/localhost/heimdall/storage/logs/laravel.log" ]] \
&& rm -rf "/var/www/localhost/heimdall/storage/logs/laravel.log"
[[ ! -L "/var/www/localhost/heimdall/storage/logs/laravel.log" ]] && \
ln -s "/config/log/heimdall/laravel.log" "/var/www/localhost/heimdall/storage/logs/laravel.log"
# copy .env if not exists # copy .env if not exists
[[ ! -f /config/www/.env ]] && \ [[ ! -f /config/www/.env ]] && \
cp /var/www/localhost/heimdall/.env.example /config/www/.env && \ cp /var/www/localhost/heimdall/.env.example /config/www/.env && \

View File

@@ -0,0 +1,9 @@
/config/log/heimdall/laravel.log {
size 5M
rotate 5
compress
nodateext
notifempty
missingok
su abc abc
}