Code Review
/
bottlenecks.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
b3d6a27bba244028039fd2f7fa8c1ec91d789145
[bottlenecks.git]
/
utils
/
infra_setup
/
heat_template
/
vstf_heat_template
/
scp.sh
1
function scp_cmd()
2
{
3
local ip=$1
4
local usr=$2
5
local passwd=$3
6
srcfile=$4
7
desfile=$5
8
opt=$6
9
case $opt in
10
file)
11
expect -c "
12
spawn scp -r $srcfile $usr@$ip:$desfile
13
set timeout -1
14
expect {
15
\"*no)?\" {
16
send \"yes\r\"
17
exp_continue
18
}
19
\"*assword:*\" {
20
send \"$passwd\r\"
21
exp_continue
22
}
23
}
24
"
25
;;
26
dir)
27
expect -c "
28
spawn scp -r $srcfile $usr@$ip:$desfile
29
set timeout -1
30
expect {
31
\"*no)?\" {
32
send \"yes\r\"
33
exp_continue
34
}
35
\"*assword:*\" {
36
send \"$passwd\r\"
37
exp_continue
38
}
39
}
40
"
41
;;
42
*)
43
echo "err"
44
;;
45
esac
46
}
47
48
function remote_scp_cmd()
49
{
50
local ip=$1
51
local usr=$2
52
local passwd=$3
53
srcfile=$4
54
desfile=$5
55
opt=$6
56
case $opt in
57
file)
58
expect -c "
59
spawn scp -r $usr@$ip:$srcfile $desfile
60
set timeout -1
61
expect {
62
\"*no)?\" {
63
send \"yes\r\"
64
exp_continue
65
}
66
\"*assword:*\" {
67
send \"$passwd\r\"
68
exp_continue
69
}
70
}
71
"
72
;;
73
dir)
74
expect -c "
75
spawn scp -r $usr@$ip:$srcfile $desfile
76
set timeout -1
77
expect {
78
\"*no)?\" {
79
send \"yes\r\"
80
exp_continue
81
}
82
\"*assword:*\" {
83
send \"$passwd\r\"
84
exp_continue
85
}
86
}
87
"
88
;;
89
*)
90
echo "err"
91
;;
92
esac
93
}