auto rsync

#!/bin/bash

src=$1
dst=$2
psd=$3
flag=$4
port=$5
if [ "$port" == "" ];then
    port=22
fi

echo "$1"
echo "$2"
echo "$3"
echo "$4"
echo "$5"

expect<<- END

set timeout -1

spawn rsync -e "ssh -p $port" $flag $src $dst

expect {
 "continue connecting (yes/no"
   {
    send "yes\n"
    expect "*assword:" { send "$psd\n"}
   }
 "*assword:"
 {
   send "$psd\n"
 }
}

expect eof

catch wait result
exit [lindex \$result 3]

END

ret=$?

# echo "[info] auto_scp ret $ret"
exit $ret

你可能感兴趣的:(chrome,网络,前端)