-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscptoremote.sh
More file actions
58 lines (48 loc) · 1.78 KB
/
scptoremote.sh
File metadata and controls
58 lines (48 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env expect
set timeout -1
spawn rm -rf /var/tmp/*
spawn df -kh /var/tmp
if { $::env(TRIAL_RUN) == true } {
puts "Trial Run is true"
spawn scp -oStrictHostKeyChecking=no $::env(HUB_USER:/installgz.exp /var/tmp/install.exp
} else {
puts "Trial run is false"
spawn scp -oStrictHostKeyChecking=no $::env(HUB_USER):/home/elephant/monitoring/install_monitoring_7z.exp /var/tmp/install_monitoring.exp
}
expect {
"yes/no" {send "yes\r"}
"assword" {send "$::env(HUB_PASS)\r"}
}
expect "100%"
#scp package from hub to /var/tmp
spawn scp -oStrictHostKeyChecking=no $::env(HUB_USER)@ /var/tmp/
expect {
"yes/no" {send "yes\r";exp_continue}
"Enter Windows password:" {send "$::env(HUB_PASS)\r"}
}
expect {
"100%" {}
"%" {exp_continue}
}
spawn scp -oStrictHostKeyChecking=no file root@$::env(SERVER_HOSTNAME):/var/tmp/
expect {
"yes/no" {send "yes\r"exp_continue}
"assword" {send "$::env(VAPP_PASS)\r";exp_continue}
"y,n" {send "y\r";exp_continue}
-re {Removal of .* was successful} {}
"ERROR: no package associated with" {}
}
spawn scp file root@$::env(SERVER_HOSTNAME):/var/tmp/
expect {
"yes/no" {send "yes\r"exp_continue}
"assword" {send "$::env(VAPP_PASS)\r";exp_continue}
"y,n" {send "y\r";exp_continue}
-re {Removal of .* was successful} {}
"ERROR: no package associated with" {}
}
spawn ssh root@$::env(SERVER_HOSTNAME) "chmod 777 file ; /var/tmp/install_monitoring.exp"
expect {
"yes/no" {send "yes\r"exp_continue}
"assword" {send "$::env(VAPP_PASS)\r";exp_continue}
"y,n" {send "y\r";exp_continue}
}