Skip to content

Instantly share code, notes, and snippets.

@MetehanYurtseven
Created June 11, 2022 16:07
Show Gist options
  • Select an option

  • Save MetehanYurtseven/040929c93bf40b3bff90a5201e87b6b9 to your computer and use it in GitHub Desktop.

Select an option

Save MetehanYurtseven/040929c93bf40b3bff90a5201e87b6b9 to your computer and use it in GitHub Desktop.
Bash script to change the peer-port of Transmission through rpc
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Usage: ./transmission_port.sh https://transmission.example.com 51413"
exit 1
fi
session_id=$(curl "$1/transmission/rpc" -H "content-type: application/json" -s -D - -o /dev/null | awk '/^x-transmission-session-id:/ { print $2 }')
curl "$1/transmission/rpc" -H "content-type: application/json" -H "x-transmission-session-id: $session_id" --data-raw "{\"arguments\":{\"peer-port\":$2,\"peer-port-random-on-start\":false,\"port-forwarding-enabled\":false,\"utp-enabled\":false},\"method\":\"session-set\"}" --http1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment