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
|
#!/usr/bin/env bash
|
||||||
scriptVersion="1.3"
|
scriptVersion="1.4"
|
||||||
scriptName="Recyclarr"
|
scriptName="Recyclarr"
|
||||||
|
|
||||||
#### Import Settings
|
|
||||||
source /config/extended.conf
|
|
||||||
|
|
||||||
log () {
|
log () {
|
||||||
m_time=`date "+%F %T"`
|
m_time=`date "+%F %T"`
|
||||||
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
echo $m_time" :: $scriptName :: $scriptVersion :: "$1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$enableRecyclarr" != "true" ]; then
|
logfileSetup () {
|
||||||
log "Script is not enabled, enable by setting enableRecyclarr to \"true\" by modifying the \"/config/extended.conf\" config file..."
|
# auto-clean up log file to reduce space usage
|
||||||
log "Sleeping (infinity)"
|
if [ -f "/config/logs/Recyclarr.txt" ]; then
|
||||||
sleep infinity
|
find /config/logs -type f -name "Recyclarr.txt" -size +1024k -delete
|
||||||
fi
|
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 () {
|
getArrAppInfo () {
|
||||||
# Get Arr App information
|
# Get Arr App information
|
||||||
|
@ -58,17 +75,6 @@ verifyApiAccess () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
RecyclarrProcess () {
|
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")
|
|
||||||
|
|
||||||
# Configure Yaml with URL and API Key
|
# Configure Yaml with URL and API Key
|
||||||
sed -i "s%arrUrl%$arrUrl%g" "/config/extended/recyclarr.yaml"
|
sed -i "s%arrUrl%$arrUrl%g" "/config/extended/recyclarr.yaml"
|
||||||
sed -i "s%arrApi%$arrApiKey%g" "/config/extended/recyclarr.yaml"
|
sed -i "s%arrApi%$arrApiKey%g" "/config/extended/recyclarr.yaml"
|
||||||
|
@ -83,9 +89,11 @@ RecyclarrProcess () {
|
||||||
log "Complete"
|
log "Complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
log "Starting Script...."
|
# Loop Script
|
||||||
for (( ; ; )); do
|
for (( ; ; )); do
|
||||||
let i++
|
let i++
|
||||||
|
logfileSetup
|
||||||
|
verifyConfig
|
||||||
getArrAppInfo
|
getArrAppInfo
|
||||||
verifyApiAccess
|
verifyApiAccess
|
||||||
RecyclarrProcess
|
RecyclarrProcess
|
||||||
|
|
Loading…
Reference in a new issue