Update and rename 00-refresh_files.sh to 02-refresh_files.sh

This commit is contained in:
Alexandre
2023-03-08 20:30:57 +01:00
committed by GitHub
parent f6494a7449
commit 96bde98487
2 changed files with 17 additions and 12 deletions

View File

@@ -1,12 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# Clean nginx files at each reboot
if [ -d /data/config/nginx ]; then
rm -r /data/config/nginx
fi
# rm /data/config/crontabs
if [ -d /data/config/crontabs ]; then
rm -r /data/config/crontabs
fi

View File

@@ -0,0 +1,17 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# Clean nginx files at each reboot
for folders in /data/config/nginx /data/config/crontabs /data/config/logs; do
if [ -d "$folders" ]; then rm -r "$folders"; fi
done
# Make links between logs and docker
for logfile in /data/config/log/nginx/error.log /data/config/log/nginx/access.log /data/config/log/php/error.log /data/config/log/nextcloud.log; do
# Make sure directory exists
mkdir -p "$(dirname "$logfile")"
# Clean files
if [ -f "$logfile" ]; then rm -r "$logfile"; fi
# Create symlink
ln -sf /proc/1/fd/1 "$logfile"
done