v1.1 improved logging

This commit is contained in:
RandomNinjaAtk 2023-07-14 19:30:36 +00:00 committed by GitHub
parent 612d2181d0
commit 7a081f6ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
scriptVersion="1.0.6" scriptVersion="1.1"
scriptName="QueueCleaner" scriptName="QueueCleaner"
#### Import Settings #### Import Settings
@ -10,22 +10,26 @@ log () {
echo $m_time" :: $scriptName :: $scriptVersion :: "$1 echo $m_time" :: $scriptName :: $scriptVersion :: "$1
} }
if [ "$enableQueueCleaner" != "true" ]; then verifyConfig () {
log "Script is not enabled, enable by setting enableQueueCleaner to \"true\" by modifying the \"/config/extended.conf\" config file..." if [ "$enableQueueCleaner" != "true" ]; then
log "Sleeping (infinity)" log "Script is not enabled, enable by setting enableQueueCleaner to \"true\" by modifying the \"/config/extended.conf\" config file..."
sleep infinity log "Sleeping (infinity)"
fi sleep infinity
fi
}
# auto-clean up log file to reduce space usage logfileSetup () {
if [ -f "/config/logs/QueueCleaner.txt" ]; then # auto-clean up log file to reduce space usage
find /config/logs -type f -name "QueueCleaner.txt" -size +1024k -delete if [ -f "/config/logs/QueueCleaner.txt" ]; then
fi find /config/logs -type f -name "QueueCleaner.txt" -size +1024k -delete
fi
if [ ! -f "/config/logs/QueueCleaner.txt" ]; then
touch "/config/logs/QueueCleaner.txt" if [ ! -f "/config/logs/QueueCleaner.txt" ]; then
chmod 666 "/config/logs/QueueCleaner.txt" touch "/config/logs/QueueCleaner.txt"
fi chmod 666 "/config/logs/QueueCleaner.txt"
exec &> >(tee -a "/config/logs/QueueCleaner.txt") fi
exec &> >(tee -a "/config/logs/QueueCleaner.txt")
}
QueueCleanerProcess () { QueueCleanerProcess () {
# Get Arr App information # Get Arr App information
@ -114,13 +118,12 @@ verifyApiAccess () {
done done
} }
# Install packages
PackageInstallation
arrName="$(cat /config/config.xml | xq | jq -r .Config.InstanceName)" arrName="$(cat /config/config.xml | xq | jq -r .Config.InstanceName)"
if [ "$arrName" == "Sonarr" ] || [ "$arrName" == "Radarr" ] || [ "$arrName" == "Lidarr" ] || [ "$arrName" == "Readarr" ]; then if [ "$arrName" == "Sonarr" ] || [ "$arrName" == "Radarr" ] || [ "$arrName" == "Lidarr" ] || [ "$arrName" == "Readarr" ]; then
for (( ; ; )); do for (( ; ; )); do
let i++ let i++
logfileSetup
verifyConfig
log "Starting..." log "Starting..."
QueueCleanerProcess QueueCleanerProcess
log "Sleeping 15m..." log "Sleeping 15m..."