v1.4 - improve logging
This commit is contained in:
parent
7a081f6ddf
commit
8ffbc5732b
1 changed files with 30 additions and 22 deletions
|
@ -1,20 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
scriptVersion="1.3"
|
||||
scriptVersion="1.4"
|
||||
scriptName="Recyclarr"
|
||||
|
||||
#### Import Settings
|
||||
source /config/extended.conf
|
||||
|
||||
log () {
|
||||
m_time=`date "+%F %T"`
|
||||
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
||||
}
|
||||
|
||||
if [ "$enableRecyclarr" != "true" ]; then
|
||||
log "Script is not enabled, enable by setting enableRecyclarr to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
||||
log "Sleeping (infinity)"
|
||||
sleep infinity
|
||||
fi
|
||||
logfileSetup () {
|
||||
# auto-clean up log file to reduce space usage
|
||||
if [ -f "/config/logs/Recyclarr.txt" ]; then
|
||||
find /config/logs -type f -name "Recyclarr.txt" -size +1024k -delete
|
||||
fi
|
||||
|
||||
if [ ! -f "/config/logs/Recyclarr.txt" ]; then
|
||||
touch "/config/logs/Recyclarr.txt"
|
||||
chmod 666 "/config/logs/Recyclarr.txt"
|
||||
fi
|
||||
exec &> >(tee -a "/config/logs/Recyclarr.txt")
|
||||
}
|
||||
|
||||
verifyConfig () {
|
||||
#### Import Settings
|
||||
source /config/extended.conf
|
||||
|
||||
if [ "$enableRecyclarr" != "true" ]; then
|
||||
log "Script is not enabled, enable by setting enableRecyclarr to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
||||
log "Sleeping (infinity)"
|
||||
sleep infinity
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
getArrAppInfo () {
|
||||
# Get Arr App information
|
||||
|
@ -57,18 +74,7 @@ verifyApiAccess () {
|
|||
fi
|
||||
done
|
||||
}
|
||||
RecyclarrProcess () {
|
||||
# auto-clean up log file to reduce space usage
|
||||
if [ -f "/config/logs/Recyclarr.txt" ]; then
|
||||
find /config/logs -type f -name "Recyclarr.txt" -size +1024k -delete
|
||||
fi
|
||||
|
||||
if [ ! -f "/config/logs/Recyclarr.txt" ]; then
|
||||
touch "/config/logs/Recyclarr.txt"
|
||||
chmod 666 "/config/logs/Recyclarr.txt"
|
||||
fi
|
||||
exec &> >(tee -a "/config/logs/Recyclarr.txt")
|
||||
|
||||
RecyclarrProcess () {
|
||||
# Configure Yaml with URL and API Key
|
||||
sed -i "s%arrUrl%$arrUrl%g" "/config/extended/recyclarr.yaml"
|
||||
sed -i "s%arrApi%$arrApiKey%g" "/config/extended/recyclarr.yaml"
|
||||
|
@ -83,9 +89,11 @@ RecyclarrProcess () {
|
|||
log "Complete"
|
||||
}
|
||||
|
||||
log "Starting Script...."
|
||||
# Loop Script
|
||||
for (( ; ; )); do
|
||||
let i++
|
||||
logfileSetup
|
||||
verifyConfig
|
||||
getArrAppInfo
|
||||
verifyApiAccess
|
||||
RecyclarrProcess
|
||||
|
|
Loading…
Reference in a new issue