lidarr-dl/universal/services/Recyclarr
2023-07-20 11:18:55 +00:00

54 lines
1.3 KiB
Bash

#!/usr/bin/env bash
scriptVersion="1.7"
scriptName="Recyclarr"
#### Import Settings
source /config/extended.conf
#### Import Functions
source /config/extended/functions
#### Create Log File
logfileSetup
#### Check Arr App
getArrAppInfo
verifyApiAccess
verifyConfig () {
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
if [ -z "$recyclarrScriptInterval" ]; then
recyclarrScriptInterval="6h"
fi
}
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"
# update arr app
log "Updating Sonarr via Recyclarr"
if [ ! -d /config/extended/recyclarr-data ]; then
mkdir -p /config/extended/recyclarr-data
chmod 777 /config/extended/recyclarr-data
fi
/recyclarr/recyclarr sync $recylcarrApp -c $recyclarrConfig --app-data /config/extended/recyclarr-data
log "Complete"
}
# Loop Script
for (( ; ; )); do
let i++
logfileSetup
verifyConfig
getArrAppInfo
verifyApiAccess
RecyclarrProcess
log "Script sleeping for $recyclarrScriptInterval..."
sleep $recyclarrScriptInterval
done
exit