diff --git a/universal/services/QueueCleaner b/universal/services/QueueCleaner index d5ea771..de8122d 100644 --- a/universal/services/QueueCleaner +++ b/universal/services/QueueCleaner @@ -1,5 +1,5 @@ #!/usr/bin/with-contenv bash -scriptVersion="1.5" +scriptVersion="1.6" scriptName="QueueCleaner" log () { @@ -7,6 +7,22 @@ log () { echo $m_time" :: $scriptName :: $scriptVersion :: "$1 } +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 +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 @@ -22,19 +38,6 @@ verifyConfig () { fi } -logfileSetup () { - # 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 - - if [ ! -f "/config/logs/QueueCleaner.txt" ]; then - touch "/config/logs/QueueCleaner.txt" - chmod 666 "/config/logs/QueueCleaner.txt" - fi - exec &> >(tee -a "/config/logs/QueueCleaner.txt") -} - QueueCleanerProcess () { # Get Arr App information if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then