diff options
author | carey.xu <carey.xuhan@huawei.com> | 2015-08-10 23:02:31 -0400 |
---|---|---|
committer | carey.xu <carey.xuhan@huawei.com> | 2015-08-13 04:24:03 -0400 |
commit | 10e776642a16b2584be88e5be8740f05535d7d06 (patch) | |
tree | bf386defd6cde54c6003a3855fb852fe1806bdd7 /deploy/remote_excute.exp | |
parent | 5aedf594112c0749b6e9039d15b9fe70d210a942 (diff) |
Add deploy scripts for compass
JIRA: COMPASS-11
Change-Id: Id588912c73b424228b6f01cd47fd282d040f7b8f
Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/remote_excute.exp')
-rwxr-xr-x | deploy/remote_excute.exp | 35 |
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" |