From 16f624cf21d3259bc66a1fd04125862282d00c71 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 12 Jul 2023 13:16:05 +0000 Subject: [PATCH] v.1.0.6 - Make configurable #3 --- universal/services/QueueCleaner | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/universal/services/QueueCleaner b/universal/services/QueueCleaner index c1fbecb..74c0a72 100644 --- a/universal/services/QueueCleaner +++ b/universal/services/QueueCleaner @@ -1,25 +1,21 @@ #!/usr/bin/with-contenv bash -scriptVersion="1.0.5" +scriptVersion="1.0.6" +scriptName="QueueCleaner" -######## Settings -scriptInterval="15m" +#### Import Settings +source /config/extended.conf -######## Package dependencies installation -PackageInstallation () { - if [ ! -f "/config/logs/QueueCleaner.txt" ]; then - echo "Installing Required Packages..." - apk add -U --update --no-cache curl jq python3-dev py3-pip &>/dev/null - pip install --upgrade --no-cache-dir -U yq &>/dev/null - echo "Done" - fi -} - -# Logging output function log () { m_time=`date "+%F %T"` - echo $m_time" :: QueueCleaner :: $scriptVersion :: "$1 + echo $m_time" :: $scriptName :: $scriptVersion :: "$1 } +if [ "$enableQueueCleaner" != "true" ]; then + log "Script is not enabled, enable by setting enableQueueCleaner to \"true\" by modifying the \"/config/extended.conf\" config file..." + log "Sleeping (infinity)" + sleep infinity +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 @@ -127,8 +123,8 @@ if [ "$arrName" == "Sonarr" ] || [ "$arrName" == "Radarr" ] || [ "$arrName" == " let i++ log "Starting..." QueueCleanerProcess - log "Sleeping $scriptInterval..." - sleep $scriptInterval + log "Sleeping 15m..." + sleep 15m done else log "ERROR :: Arr app not detected, exiting..."