-
Notifications
You must be signed in to change notification settings - Fork 2
/
online.tcl
executable file
·30 lines (27 loc) · 1.01 KB
/
online.tcl
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
set pwd "ta0mee@nh\r"
set ept ":~#"
set ip "222.73.105.93"
set timeout 15
spawn ./scp
expect {
-re "password:" { send $pwd; expect {
-re $ept { }
-re "password:" { send $pwd; expect $ept }
}
}
-re $ept { } -re "(yes/no).*" { send "yes\r"; expect "password:"; send $pwd; expect $ept }
timeout { send_user "$ip connection time out\r\n" ; close ; return }
}
spawn ssh -p56000 -lroot "$ip"
expect {
-re "password:" { send $pwd; expect {
-re ":~#" { }
-re "password:" { send $pwd; expect ":~#" }
}
}
-re ":~#" { }
-re "(yes/no).*" { send "yes\r"; expect "password:"; send $pwd; expect ":~#" }
timeout { send_user "$ip connection time out\r\n" ; close ; return }
}
send "cd /opt/taomee/onlinetest; mv StableOnline OnlineTest1; rm ./log/*; ./startup.sh; logout\r"
expect $ept