Created
August 23, 2021 05:51
-
-
Save fieu/6c4f34af5618872f1ae330079129f3d1 to your computer and use it in GitHub Desktop.
Deluge Tracker Update Script - Modified from: https://www.seedhost.eu/whmcs/knowledgebase/266/Deluge-update-tracker-script.html
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
#!/usr/bin/env bash | |
torrentid="$1" | |
torrentname="$2" | |
torrentpath="$3" | |
x=1 | |
ddport=$(grep '"daemon_port": [0-9]*' ~/.config/deluge/core.conf | awk -F ': ' '{print $2}' | awk -F ',' '{print $1}') | |
host="127.0.0.1" | |
user="user" | |
pass="password" | |
logfile="$HOME/deluge-tracker-update.log" | |
while [ $x -le 100 ]; do | |
sleep 2 | |
echo "Running $x times" >>$logfile | |
echo "TorrentID: $torrentid" >>$logfile | |
line=$(deluge-console "connect $host:$ddport $user $pass; info" $1 | grep "Tracker status") | |
echo $line >>$logfile | |
case "$line" in | |
*unregistered* | *Sent* | *End*of*file* | *Bad*Gateway* | *Error*) | |
deluge-console "connect $host:$ddport $user $pass; pause '$torrentid'" | |
sleep 2 | |
deluge-console "connect $host:$ddport $user $pass; resume '$torrentid'" | |
;; | |
*) | |
echo "Found working torrent: $torrentname $torrentid" >>$logfile | |
exit 1 | |
;; | |
esac | |
x=$(($x + 1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment