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