
On Wed, Sep 30, 2020 at 05:03:35PM +0800, Ren Wen 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)) + ssh -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o TCPKeepAlive=yes -Nf -R $port:localhost:22 sshr@"$sshr_ip" -p "$sshr_port" &>/dev/null
This line may be too long, can use '/' to split or put options into an array.
Thanks, RenWen
Ok, I got it. Thanks, Yale
+ [ $? -eq 0 ] || continue + echo "$port" + break + done +} + -- 2.23.0