From 5dc4b41537f4ee5ac5ca0675dcb295daa296a157 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Sun, 19 Mar 2023 10:57:24 -0400 Subject: [PATCH] v1.0.8 - loging process fix Change order of operations --- QueueCleaner.bash | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/QueueCleaner.bash b/QueueCleaner.bash index 03ffd06..af7c9a1 100644 --- a/QueueCleaner.bash +++ b/QueueCleaner.bash @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="1.0.7" +scriptVersion="1.0.8" ######## Settings scriptInterval="15m" @@ -14,6 +14,15 @@ log () { echo $m_time" :: QueueCleaner :: $scriptVersion :: "$1 } +# auto-clean up log file to reduce space usage +if [ -f "/config/logs/QueueCleaner.txt" ]; then + find /config/logs -type f -name "QueueCleaner.txt" -size +1024k -delete +fi + +touch "/config/logs/QueueCleaner.txt" +chmod 666 "/config/logs/QueueCleaner.txt" +exec &> >(tee -a "/config/logs/QueueCleaner.txt") + QueueCleanerProcess () { # Get Arr App information if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then @@ -29,15 +38,6 @@ QueueCleanerProcess () { arrUrl="http://127.0.0.1:${arrPort}${arrUrlBase}" fi - # auto-clean up log file to reduce space usage - if [ -f "/config/logs/QueueCleaner.txt" ]; then - find /config/logs -type f -name "QueueCleaner.txt" -size +1024k -delete - fi - - touch "/config/logs/QueueCleaner.txt" - chmod 666 "/config/logs/QueueCleaner.txt" - exec &> >(tee -a "/config/logs/QueueCleaner.txt") - verifyApiAccess if [ "$arrName" == "Sonarr" ]; then