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