-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmups.exp
More file actions
executable file
·58 lines (44 loc) · 1.37 KB
/
mups.exp
File metadata and controls
executable file
·58 lines (44 loc) · 1.37 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/expect
set timeout 25
# Get the password from the user.
proc get_password {} {
send "Password: " ;# prompt user for password
stty -echo ;# turn off echoing
expect -re "..+" ;# expect input matching this regexp
set passwd $expect_out(buffer) ;# set variable 'passwd'
stty echo ;# turn echoing back on
return $passwd
}
proc tail_mup { mupserver pattern } {
send "ssh bastion.myphotoalbum.com\r"
expect "GENERIC"
send "ssh $mupserver\r"
expect "$pattern"
send "cd /opt/apache2/logs\r"
expect "logs"
send "tail -f `ls -tr *error* | tail -1`\r"
}
#set passwd [get_password]
# Set up GNU screen
spawn "/usr/bin/screen"
expect "to end"
send "\r"
expect "kristalle" ;# match my shell prompt
tail_mup "mup-1" "authorized"
send "S c" ;# split screen, switch to it, start bash
tail_mup "mup-2" "authorized"
send "S c" ;# split screen, switch to it, start bash
tail_mup "mup-3" "authorized"
send "S c" ;# split screen, switch to it, start bash
tail_mup "swg-3" "authorized"
interact
puts "mups.exp done."
# here's how we did the sudo -s
#send "sudo -s\r"
#expect {
# "assword" {
# send "$passwd\r";
# expect "root"
# }
# "root" ;# do nothing. we are already root.
#}