On Fri, Oct 09, 2020 at 11:21:29AM +0800, Tong Qunfeng wrote:
On Wed, Sep 30, 2020 at 03:41:01PM +0800, Zhang Yale wrote:
Provide a login port for user, determine whether to send the ssh_port message based on the uuid.
Signed-off-by: Zhang Yale ylzhangah@qq.com Signed-off-by: Luan Shengde luanshengde2@huawei.com
lib/transfer_port.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 lib/transfer_port.sh
diff --git a/lib/transfer_port.sh b/lib/transfer_port.sh new file mode 100755 index 00000000..61fb67b4 --- /dev/null +++ b/lib/transfer_port.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# uuid
+. $LKP_SRC/lib/http.sh
+sshr_ip=$LKP_SERVER +sshr_port=5050
+get_port() +{
- [ -n "$uuid" ] || return
- for i in $(seq 1 10)
- do
port=$(($(date +%s%N)%10+11333))
"10"(port range length?) and "11333" (port base?) we need define this 2 field. ssh_port_len and ssh_port_base?
Ok, I got it.
Thanks, Yale
ssh -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o TCPKeepAlive=yes -Nf -R $port:localhost:22 sshr@"$sshr_ip" -p "$sshr_port" &>/dev/null
[ $? -eq 0 ] || continue
echo "$port"
break
- done
+}
-- 2.23.0
-- Thanks. chief tongqunfeng@huawei.com