wait for transmission to become responsive before trying to set the port

This commit is contained in:
nicknlsn
2019-10-13 17:57:26 -06:00
parent c98018f1aa
commit 66a91a8b3b
47 changed files with 54 additions and 47 deletions

View File

@@ -74,6 +74,13 @@ else
myauth=""
fi
# make sure transmission is running and accepting requests
echo "waiting for transmission to become responsive"
until torrent_list="$(transmission-remote $myauth -l)"; do sleep 10; done
echo "transmission became responsive"
output="$(echo "$torrent_list" | tail -n 2)"
echo "$output"
# get current listening port
transmission_peer_port=$(transmission-remote $myauth -si | grep Listenport | grep -oE '[0-9]+')
if [ "$new_port" != "$transmission_peer_port" ]; then
@@ -87,7 +94,7 @@ if [ "$new_port" != "$transmission_peer_port" ]; then
ufw allow "$new_port"
fi
transmission-remote $myauth -p "$new_port"
transmission-remote ${myauth} -p "$new_port"
echo "Checking port..."
sleep 10