remove stored port when the API did not return ok when trying to bind port

This commit is contained in:
StudioEtrange 2021-01-31 04:32:56 +01:00
parent 4156832879
commit 48ce4727fe

View File

@ -160,6 +160,8 @@ while true; do
export bind_port_response
if [ "$(echo "$bind_port_response" | jq -r '.status')" != "OK" ]; then
echo -e "${RED}The API did not return OK when trying to bind port... Exiting."
# remove stored port as it is now invalid
rm -f /opt/piavpn-manual/port
exit 1
fi
echo -e Forwarded port'\t'${GREEN}$port${NC}