-
-
Notifications
You must be signed in to change notification settings - Fork 510
feat(extras/scripts): update Transmission peer port #2611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for the final exit 😉 (afaik)
| exit 0 |
Co-authored-by: Quentin McGaw <[email protected]>
Co-authored-by: Quentin McGaw <[email protected]>
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
| echo "Success! Transmission peer-port updated to ${PORT}" | |
| echo "Transmission peer-port updated to ${PORT}" |
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.