Skip to content

Commit 655d9a4

Browse files
authored
Merge pull request #686 from dappnode/marc/ports80-443-https-running
check if 80 and 443 ports are used & https running
2 parents 09dc55a + c6fb055 commit 655d9a4

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

scripts/dappnode_install.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,27 @@ is_iso_install() {
5757
fi
5858
}
5959

60-
# Check is port 80 in used (necessary for HTTPS)
60+
# Check if port 80 is in use (necessary for HTTPS)
61+
# Returns IS_PORT_USED=true only if port 80 or 443 is used by something OTHER than our HTTPS container
6162
is_port_used() {
62-
lsof -i -P -n | grep ":80 (LISTEN)" &>/dev/null && IS_PORT_USED=true || IS_PORT_USED=false
63+
# Check if port 80 or 443 is in use at all
64+
local port80_used port443_used
65+
lsof -i -P -n | grep ":80 (LISTEN)" &>/dev/null && port80_used=true || port80_used=false
66+
lsof -i -P -n | grep ":443 (LISTEN)" &>/dev/null && port443_used=true || port443_used=false
67+
68+
if [ "$port80_used" = false ] && [ "$port443_used" = false ]; then
69+
IS_PORT_USED=false
70+
return
71+
fi
72+
73+
# If either port is in use, check if it's our HTTPS container
74+
if docker ps --format '{{.Names}}' 2>/dev/null | grep -q "^DAppNodeCore-https.dnp.dappnode.eth$"; then
75+
# Port 80 or 443 is used by our HTTPS container, so we consider it "not used" for package determination
76+
IS_PORT_USED=false
77+
else
78+
# Port 80 or 443 is used by something else
79+
IS_PORT_USED=true
80+
fi
6381
}
6482

6583
# Determine packages to be installed

0 commit comments

Comments
 (0)