aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/remote_excute.exp
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/remote_excute.exp')
-rwxr-xr-xdeploy/remote_excute.exp35
1 files changed, 35 insertions, 0 deletions
diff --git a/deploy/remote_excute.exp b/deploy/remote_excute.exp
new file mode 100755
index 00000000..ac901353
--- /dev/null
+++ b/deploy/remote_excute.exp
@@ -0,0 +1,35 @@
+#!/usr/bin/expect
+
+set addr [lindex $argv 0]
+set user [lindex $argv 1]
+set passwd [lindex $argv 2]
+set command [lindex $argv 3]
+set cmd_prompt "]#|~]?"
+
+eval spawn ssh $user@$addr
+set timeout 60
+
+expect {
+ -re ".*es.*o.*"
+ {
+ exp_send "yes\r"
+ exp_continue
+ }
+
+ -re ".*sword:" {
+ exp_send "$passwd\r"
+ exp_continue
+ }
+ -re $cmd_prompt {
+ exp_send "$command\r"
+ }
+}
+
+exec sleep 1
+
+expect {
+ -re $cmd_prompt {
+ send "exit\r"
+ }
+}
+send "exit 1\r"