v1.0.002 - Logging enhancements

pull/49/head
RandomNinjaAtk 2 years ago committed by GitHub
parent f6fa2e23ce
commit 75ef6acaa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,28 +1,46 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="1.0.001" scriptVersion="1.0.002"
if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then iif [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then
arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
if [ "$arrUrlBase" = "null" ]; then if [ "$arrUrlBase" = "null" ]; then
arrUrlBase="" arrlBase=""
else else
arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///g")" arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///g")"
fi fi
arrApiKey="$(cat /config/config.xml | xq | jq -r .Config.ApiKey)" arrApiKey="$(cat /config/config.xml | xq | jq -r .Config.ApiKey)"
arrUrl="http://127.0.0.1:7878${arrUrlBase}" arrPort="$(cat /config/config.xml | xq | jq -r .Config.Port)"
arrUrl="http://127.0.0.1:${arrPort}${arrUrlBase}"
fi fi
# 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
exec &>> "/config/logs/Recyclarr.txt"
chmod 666 "/config/logs/Recyclarr.txt"
log () {
m_time=`date "+%F %T"`
echo $m_time" :: Recycalarr :: "$1
}
# Configure Yaml with URL and API Key # Configure Yaml with URL and API Key
sed -i "s%arrUrl%$arrUrl%g" "/recyclarr.yaml" sed -i "s%arrUrl%$arrUrl%g" "/recyclarr.yaml"
sed -i "s%arrApi%$arrApiKey%g" "/recyclarr.yaml" sed -i "s%arrApi%$arrApiKey%g" "/recyclarr.yaml"
if [ ! -f /config/extended/configs/recyclarr.yaml ]; then if [ ! -f /config/extended/configs/recyclarr.yaml ]; then
log "Importing default recylarr config file to: /config/extended/configs/recyclarr.yaml"
cp "/recyclarr.yaml" "/config/extended/configs/recyclarr.yaml" cp "/recyclarr.yaml" "/config/extended/configs/recyclarr.yaml"
chmod 766 "/config/extended/configs/recyclarr.yaml" chmod 766 "/config/extended/configs/recyclarr.yaml"
chown abc:abc "/config/extended/configs/recyclarr.yaml" chown abc:abc "/config/extended/configs/recyclarr.yaml"
fi fi
# update radarr # update radarr
log "Updating Radarr via Recyclarr"
/recyclarr/recyclarr radarr -c /config/extended/configs/recyclarr.yaml --app-data /recylarr /recyclarr/recyclarr radarr -c /config/extended/configs/recyclarr.yaml --app-data /recylarr
log "Complete"
exit exit

Loading…
Cancel
Save