feat(extras/scripts): update Transmission peer port#2611
feat(extras/scripts): update Transmission peer port#2611juanlufont wants to merge 9 commits intoqdm12:masterfrom
Conversation
The script `transmission-port-update.sh` updates the _peer port_ used by the torrent client Transmission. The peer port is the port used and announced by Transmission to accept incoming connections.
|
I've used this script and it worked on the first try. Thank you! |
|
Just reporting that I've been using this for over a month and it's been working flawlessly 👌 |
- better error handling - support for comma-separated list of ports (use only first one) - style corrections - improved messages
qdm12
left a comment
There was a problem hiding this comment.
Thanks for the review of the PR (and the wiki PR 👍 ) Just a few minor things to do if possible 🙏 thanks!
| fi | ||
|
|
||
| echo "Success! Transmission peer-port updated to ${PORT}" | ||
| exit 0 |
There was a problem hiding this comment.
no need for the final exit 😉 (afaik)
| exit 0 |
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
|
I did some tests in k3s with gluetun |
This comment was marked as off-topic.
This comment was marked as off-topic.
Let's add |
| # get the X-Transmission-Session-Id | ||
| # shellcheck disable=SC2086 | ||
| SESSION_ID=$( | ||
| wget \ | ||
| --quiet \ | ||
| ${WGET_OPTS} \ | ||
| --server-response \ | ||
| "$RPC_URL" 2>&1 | | ||
| grep 'X-Transmission-Session-Id:' | | ||
| awk '{print $2}' | ||
| ) |
There was a problem hiding this comment.
consider wrapping this in a loop, which fails after some retries:
i=1
while [ "$i" -le $MAX_RETRIES ]; do
# get the X-Transmission-Session-Id
# shellcheck disable=SC2086
SESSION_ID=$(
wget \
--quiet \
${WGET_OPTS} \
--server-response \
"$RPC_URL" 2>&1 |
grep 'X-Transmission-Session-Id:' |
awk '{print $2}'
)
if [ -n "$SESSION_ID" ]; then
echo "Transmission available. SESSION_ID: $SESSION_ID"
break
else
echo "Attempt $i of $MAX_RETRIES failed, waiting for next attempt..."
sleep 5
fi
i=$(( i + 1 ))
done
| exit 1 | ||
| fi | ||
|
|
||
| echo "Success! Transmission peer-port updated to ${PORT}" |
There was a problem hiding this comment.
nit
| echo "Success! Transmission peer-port updated to ${PORT}" | |
| echo "Transmission peer-port updated to ${PORT}" |
27f74e4 to
fe3d4a9
Compare
d0247a1 to
0eeee5c
Compare
2c06921 to
9a5995f
Compare
The script
transmission-port-update.shupdates the peer port used by the torrent client Transmission using its API. The peer port is the port used and announced by Transmission to accept incoming connections. You can use this script to set a VPN forwarded port as the current listening port for Transmission.The script uses only shell scripting and can run out of the box within the current
gluetundocker image, it only relies on the commandwget, which is already included by default in the image.