File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ current_port=$(jq -r '."peer-port"' "${transmission_settings}")
9090
9191# Check if changes are needed
9292if [[ ${current_port} -eq ${port} ]]; then
93- echo " Nothing to do, port is already in used"
93+ echo " Nothing to do, port ${port} is already in used"
9494 exit 0
9595fi
9696
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ trap ' exit 0' SIGTERM
4+
5+ readonly root_dir=" /home/felipe/workspace/containers/pia-transmission-prowlarr"
6+ readonly transmission_port=" ${root_dir} /data/pia-port/port.dat"
7+
8+ if ! transmission-remote -l 2> /dev/null; then # Checks that Transmission is running
9+ >&2 echo " Transmission not running." ; exit 1
10+ fi
11+
12+ if ! [[ -f ${transmission_port} && -r ${transmission_port} ]]; then
13+ >&2 echo " Port file doesn't exist or is not readable!" ; exit 1
14+ fi
15+
16+ # Reading port
17+ PORT=$( cat " ${transmission_port} " )
18+ echo " Port read from file (${PORT} )"
19+
20+ # Changing port
21+ transmission-remote -p " ${PORT} "
22+ sleep 2
23+ # Testing port
24+ if [[ $( transmission-remote -pt) != " Port is open: Yes" ]]; then
25+ echo " Transmission port (${PORT} ) is not open!" ; exit 1
26+ fi
27+
28+ exit 0
You can’t perform that action at this time.
0 commit comments