#!/bin/bash

# 第一次要手动连入 通过下面的测试
# ** WARNING: connection is not using a post-quantum key exchange algorithm.
# ** This session may be vulnerable to "store now, decrypt later" attacks.
# ** The server may need to be upgraded. See https://openssh.com/pq.html



file_name="wwwroot"


ver_dir_name="v1.0.3"
dstHost="192.168.1.102"

src_dir="C:\Users\wyc\Desktop\version_control\${ver_dir_name}"
dstUser="heco"
dstHost="192.168.1.102"
dst_dir="/home/heco/ys_ecap_server/${ver_dir_name}"
DST_PASS="123456"


sshpass -p "$DST_PASS" ssh "${dstUser}@${dstHost}" "rm -rf '${dst_dir}/${file_name}'"
sshpass -p "$DST_PASS" scp -o StrictHostKeyChecking=no -r "${src_dir}/${file_name}" "${dstUser}@${dstHost}:${dst_dir}/${file_name}"



# 检查 SCP 命令的返回值
if [ $? -eq 0 ]; then
  echo "传输成功!"
else
  echo "传输失败:$?"
fi
