From a71813bd928aced9d5c6dbeb4d7f8d37eeb01113 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 19 Jul 2023 14:41:16 +0000 Subject: [PATCH] logging optimizations --- lidarr/Audio.service.bash | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lidarr/Audio.service.bash b/lidarr/Audio.service.bash index d945e72..e0aaa79 100644 --- a/lidarr/Audio.service.bash +++ b/lidarr/Audio.service.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="2.3" +scriptVersion="2.4" scriptName="Audio" log () { @@ -9,15 +9,20 @@ log () { logfileSetup () { # auto-clean up log file to reduce space usage - if [ -f "/config/logs/Audio.txt" ]; then - find /config/logs -type f -name "Audio.txt" -size +5000k -delete - sleep 0.01 + if [ -f "/config/logs/$scriptName.txt" ]; then + 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/Audio.txt" - exec &> >(tee -a "/config/logs/Audio.txt") - chmod 666 "/config/logs/Audio.txt" } +# Create Log, start writing... +logfileSetup +exec &> >(tee -a "/config/logs/$scriptName.txt") + verifyConfig () { #### Import Settings source /config/extended.conf