Created
July 29, 2023 13:14
-
-
Save kantjer01/f061ea6dd8e2c7239f498433d6829e51 to your computer and use it in GitHub Desktop.
upgraderr-tag-export.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script adds the 'export' tag to torrents older than a set threshold on the seedbox. | |
# cd /volume1/scripts/upgraderr | |
# load variables | |
set -o allexport | |
source /volume1/scripts/upgraderr/upgraderr.env | |
set +o allexport | |
# set variables. | |
lts_treshold="$1" # argunent in minutes, from main script | |
log="$log_dir/tag-export.$(date +"%Y-%m-%d_%H.%M").log" | |
# Add 'export'tag to torrents above export treshold on seedbox | |
echo "Add 'export' tag to torrents completed more than $lts_treshold minutes ago 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":"tagadd", | |
"subject":"export", | |
"query":"DisableCrossseed() && Now() - CompletionOn >= $lts_treshold*60 && CompletionOn > 0"} | |
CURL_DATA | |
# cleanup log files | |
if ls -t $log_dir/tag-export.*.log &>/dev/null; then | |
ls -t $log_dir/tag-export.*.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