From 1f097316ec2ce25d22ea1981caa6842ab018869c Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 15 Jul 2019 12:22:06 -0400 Subject: [PATCH] logrotate for laravel log --- root/etc/cont-init.d/50-config | 11 ++++++++--- root/etc/logrotate.d/heimdall | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 root/etc/logrotate.d/heimdall diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 8b99648..95b2cb4 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -2,7 +2,8 @@ # make our folders mkdir -p \ - /config/www/{backgrounds,icons,avatars,SupportedApps} + /config/www/{backgrounds,icons,avatars,SupportedApps} \ + /config/log/heimdall # create symlinks @@ -12,8 +13,7 @@ symlinks=( \ /var/www/localhost/heimdall/storage/app/public/icons \ /var/www/localhost/heimdall/app/SupportedApps \ /var/www/localhost/heimdall/database/app.sqlite \ -/var/www/localhost/heimdall/.env \ -/var/www/localhost/heimdall/storage/logs/laravel.log ) +/var/www/localhost/heimdall/.env ) for i in "${symlinks[@]}" do @@ -21,6 +21,11 @@ do [[ ! -L "$i" ]] && ln -s /config/www/"$(basename "$i")" "$i" 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 [[ ! -f /config/www/.env ]] && \ cp /var/www/localhost/heimdall/.env.example /config/www/.env && \ diff --git a/root/etc/logrotate.d/heimdall b/root/etc/logrotate.d/heimdall new file mode 100644 index 0000000..f777e6b --- /dev/null +++ b/root/etc/logrotate.d/heimdall @@ -0,0 +1,9 @@ +/config/log/heimdall/laravel.log { + size 5M + rotate 5 + compress + nodateext + notifempty + missingok + su abc abc +} \ No newline at end of file