projects
/
bin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8a9614c
)
vm: More precise "free port" detection
author
Martin Pitt
<martin@piware.de>
Sun, 29 Aug 2021 07:29:34 +0000
(09:29 +0200)
committer
Martin Pitt
<martin@piware.de>
Sun, 29 Aug 2021 07:29:34 +0000
(09:29 +0200)
22000 is used by syncthing, and it resets the connection. Specifically
search for a refused connection.
vm
patch
|
blob
|
history
diff --git
a/vm
b/vm
index 0f14fea1aae50c1d9d4a9290a2a03f91bf303767..53231328f6b5b7f35e478fe52754c1be331eef7d 100755
(executable)
--- a/
vm
+++ b/
vm
@@
-5,7
+5,7
@@
image="$1"
shift
# determine ssh forward port
ssh_port=22000
-
while echo '' | nc localhost $ssh_port >/dev/null
; do
+
until echo '' | nc localhost $ssh_port 2>&1 >/dev/null | grep -q 'Connection refused'
; do
ssh_port=$((ssh_port+1))
done
echo "Host ssh port: $ssh_port"