Skip to content

Commit

Permalink
additional logging for incoming port on downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jun 22, 2017
1 parent 10e4e51 commit 6e4a28b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions run/nobody/getvpnport.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/bin/bash

while [ ! -f /home/nobody/vpn_incoming_port.txt ]
vpn_port="/home/nobody/vpn_incoming_port.txt"

echo "[info] Waiting for file '${vpn_port}' to be generated (contains PIA API generated incoming port number)..."
while [ ! -f "${vpn_port}" ]
do
sleep 0.1s
done

# get port number assigned from pia's api (file contents generated by /root/getvpnport.sh)
VPN_INCOMING_PORT=$(</home/nobody/vpn_incoming_port.txt)
VPN_INCOMING_PORT=$(<"${vpn_port}")

if [[ -z "${VPN_INCOMING_PORT}" ]]; then
echo "[warn] Port forwarding is already activated on this connection, has expired, or you are NOT connected to a PIA region that supports port forwarding"
else
if [[ "${DEBUG}" == "true" ]]; then
echo "[debug] Incoming port for tunnel is '${VPN_INCOMING_PORT}'"
fi
if [[ "${DEBUG}" == "true" ]]; then
echo "[debug] Incoming port for tunnel is '${VPN_INCOMING_PORT}'"
fi

0 comments on commit 6e4a28b

Please sign in to comment.