Update Recyclarr
This commit is contained in:
parent
e14eecc85f
commit
62d4b3f518
1 changed files with 11 additions and 21 deletions
|
@ -9,12 +9,12 @@ source /config/extended/functions
|
||||||
#### Create Log File
|
#### Create Log File
|
||||||
logfileSetup
|
logfileSetup
|
||||||
|
|
||||||
# Redirect all output to a temporary log file to avoid duplicate logs
|
logfile="/config/logs/$logFileName"
|
||||||
exec &> >(tee -a /tmp/recyclarr_temp.log)
|
|
||||||
|
|
||||||
#### Check Arr App
|
log() {
|
||||||
getArrAppInfo
|
m_time=$(date "+%F %T")
|
||||||
verifyApiAccess
|
echo "$m_time :: $scriptName :: $scriptVersion :: $1" | tee -a "$logfile"
|
||||||
|
}
|
||||||
|
|
||||||
verifyConfig () {
|
verifyConfig () {
|
||||||
if [ "$enableRecyclarr" != "true" ]; then
|
if [ "$enableRecyclarr" != "true" ]; then
|
||||||
|
@ -28,13 +28,13 @@ verifyConfig () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
RecyclarrProcess () {
|
RecyclarrProcess () {
|
||||||
# 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"
|
||||||
|
|
||||||
# Update arr app
|
|
||||||
log "Updating Arr via Recyclarr"
|
log "Updating Arr via Recyclarr"
|
||||||
|
|
||||||
if [ ! -d /config/extended/recyclarr-data ]; then
|
if [ ! -d /config/extended/recyclarr-data ]; then
|
||||||
mkdir -p /config/extended/recyclarr-data
|
mkdir -p /config/extended/recyclarr-data
|
||||||
chmod 777 /config/extended/recyclarr-data
|
chmod 777 /config/extended/recyclarr-data
|
||||||
|
@ -42,23 +42,14 @@ RecyclarrProcess () {
|
||||||
|
|
||||||
# Run Recyclarr and capture the output
|
# Run Recyclarr and capture the output
|
||||||
/recyclarr/recyclarr sync -c $recyclarrConfig --app-data /config/extended/recyclarr-data 2>&1 | while IFS= read -r line; do
|
/recyclarr/recyclarr sync -c $recyclarrConfig --app-data /config/extended/recyclarr-data 2>&1 | while IFS= read -r line; do
|
||||||
log "$line"
|
echo "$(date "+%F %T") :: $scriptName :: $scriptVersion :: $line" | tee -a "$logfile"
|
||||||
done
|
done
|
||||||
|
|
||||||
log "Complete"
|
log "Complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Move the temporary log file to the final log file
|
# Main Loop
|
||||||
move_logs() {
|
|
||||||
while IFS= read -r line; do
|
|
||||||
echo "$(date "+%F %T") :: $scriptName :: $scriptVersion :: $line" >> "/config/logs/$logFileName"
|
|
||||||
done < /tmp/recyclarr_temp.log
|
|
||||||
rm /tmp/recyclarr_temp.log
|
|
||||||
}
|
|
||||||
|
|
||||||
# Loop Script
|
|
||||||
for (( ; ; )); do
|
for (( ; ; )); do
|
||||||
let i++
|
|
||||||
logfileSetup
|
logfileSetup
|
||||||
verifyConfig
|
verifyConfig
|
||||||
getArrAppInfo
|
getArrAppInfo
|
||||||
|
@ -66,7 +57,6 @@ for (( ; ; )); do
|
||||||
RecyclarrProcess
|
RecyclarrProcess
|
||||||
log "Script sleeping for $recyclarrScriptInterval..."
|
log "Script sleeping for $recyclarrScriptInterval..."
|
||||||
sleep $recyclarrScriptInterval
|
sleep $recyclarrScriptInterval
|
||||||
move_logs
|
|
||||||
done
|
done
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in a new issue