Skip to content

Instantly share code, notes, and snippets.

@kantjer01
Created July 29, 2023 13:12
Show Gist options
  • Save kantjer01/4725535b10ac0d394745c2272ad091f8 to your computer and use it in GitHub Desktop.
Save kantjer01/4725535b10ac0d394745c2272ad091f8 to your computer and use it in GitHub Desktop.
upgraderr-move_notImported.sh
#!/bin/bash
# This script moves stuck imports to post-import category on both locahost and seedbox.
# load variables
set -o allexport
source /volume1/scripts/upgraderr/upgraderr.env
set +o allexport
log="$log_dir/move_notImported.$(date +"%Y-%m-%d_%H.%M").log"
# Move stuck movies imports (24h) to post-import category on seedbox
echo "Move stuck movies imports (24h) to post-import category on seedbox" | tee $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_remote}",
"user":"${user_remote}",
"password":"${password_remote}",
"action":"category",
"subject":"movies",
"query":"DisableCrossseed() && Category contains 'radarr' && Now() - CompletionOn > 86400"}
CURL_DATA
# Move stuck series imports (24h) to post-import category on seedbox
echo "Move stuck series imports (24h) to post-import category on seedbox" | tee -a $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_remote}",
"user":"${user_remote}",
"password":"${password_remote}",
"action":"category",
"subject":"tv",
"query":"DisableCrossseed() && Category contains 'sonarr' && Now() - CompletionOn > 86400"}
CURL_DATA
# Move stuck movies imports (24h) to post-import category on localhost
echo "Move stuck movies imports (24h) to post-import category on localhost" | tee -a $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_movies_local}",
"user":"${user_local}",
"password":"${password_local}",
"action":"category",
"subject":"movies",
"query":"DisableCrossseed() && Category contains 'radarr' && Now() - CompletionOn > 86400"}
CURL_DATA
# Move stuck series imports (24h) to post-import category on localhost
echo "Move stuck series imports (24h) to post-import category on localhost" | tee -a $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_series_local}",
"user":"${user_local}",
"password":"${password_local}",
"action":"category",
"subject":"tv",
"query":"DisableCrossseed() && Category contains 'sonarr' && Now() - CompletionOn > 86400"}
CURL_DATA
# cleanup log files
if ls -t $log_dir/move_notImported.*.log &>/dev/null; then
ls -t $log_dir/move_notImported.*.log | tail -n +4 | xargs rm -f --
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment