From e8236cc2b4e336c589d371455655de581d6405a4 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 19 Jul 2023 14:46:13 +0000 Subject: [PATCH] 1.1 - logging fixes --- readarr/AutoConfig.bash | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/readarr/AutoConfig.bash b/readarr/AutoConfig.bash index 79c6564..05a11ad 100644 --- a/readarr/AutoConfig.bash +++ b/readarr/AutoConfig.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0" +scriptVersion="1.1" scriptName="AutoConfig" log () { @@ -10,14 +10,19 @@ log () { logfileSetup () { # auto-clean up log file to reduce space usage if [ -f "/config/logs/$scriptName.txt" ]; then - find /config/logs -type f -name "$scriptName.txt" -size +5000k -delete - sleep 0.01 + find /config/logs -type f -name "$scriptName.txt" -size +1024k -delete + fi + + if [ ! -f "/config/logs/$scriptName.txt" ]; then + touch "/config/logs/$scriptName.txt" + chmod 666 "/config/logs/$scriptName.txt" fi - touch "/config/logs/$scriptName.txt" - exec &> >(tee -a "/config/logs/$scriptName.txt") - chmod 666 "/config/logs/$scriptName.txt" } +# Create Log, start writing... +logfileSetup +exec &> >(tee -a "/config/logs/$scriptName.txt") + verifyConfig () { #### Import Settings source /config/extended.conf