-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployDev.sh
executable file
·57 lines (44 loc) · 1.04 KB
/
deployDev.sh
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
#!/usr/bin/expect
#
# This script should be run from within the "baddata_deploy" directory
#
# RSYNC the ROOT.war
# spawn rsync target/ROOT.war [email protected]:/tmp/.
spawn rsync -rave "ssh -i baddata_alpha.pem" ../baddata/target/ROOT.war [email protected]:/tmp/.
# expect "password:*"
# send "BaddataIO1!\r"
sleep 12
expect "$"
# SSH to the server
# spawn ssh [email protected]
spawn ssh -i baddata_alpha.pem [email protected]
# expect "password:*"
# send "BaddataIO1!\r"
sleep 2
expect "$"
# PERFORM commands
send "sudo -i\r"
expect "*#"
send "cd \/opt\/tomcat8\/webapps\r"
expect "\/opt\/tomcat8\/webapps#"
sleep 1
send "systemctl stop tomcat\r"
expect "\/opt\/tomcat8\/webapps#"
sleep 10
send "rm -rf ROOT.war ROOT\r"
expect "\/opt\/tomcat8\/webapps#"
sleep 1
send "rm -rf ..\/logs\/*\r"
expect "\/opt\/tomcat8\/webapps#"
sleep 1
send "cp \/tmp\/ROOT.war .\r"
expect "\/opt\/tomcat8\/webapps#"
sleep 1
send "systemctl start tomcat\r"
expect "\/opt\/tomcat8\/webapps#"
sleep 5
send "exit\r"
sleep 1
send "exit\r"
# DONE
expect eof