1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-17 09:41:06 +03:00
Files
mariadb-columnstore-engine/mysql/queries/nightly/perf/.svn/text-base/remote_command.sh.svn-base
2016-01-06 14:08:59 -06:00

47 lines
1.2 KiB
Plaintext

#!/usr/bin/expect
#
# $Id: remote_command.sh 2804 2012-03-22 12:57:42Z pleblanc $
#
# Remote command execution script to another server
# Argument 1 - Remote Server Host Name or IP address
# Argument 2 - Remote Server root password
# Argument 3 - Command
set timeout 1800
set USERNAME "root@"
set SERVER [lindex $argv 0]
set PASSWORD [lindex $argv 1]
set COMMAND [lindex $argv 2]
set DEBUG [lindex $argv 3]
log_user $DEBUG
spawn -noecho /bin/bash
expect -re "# "
if { $PASSWORD == "ssh" } {
set USERNAME ""
set PASSWORD ""
}
#
# send command
#
send "ssh $USERNAME$SERVER $COMMAND\n"
expect {
-re "Host key verification failed" { send_user "FAILED: Host key verification failed\n" ; exit -1}
-re "service not known" { send_user " FAILED: Invalid Host\n" ; exit -1}
-re "ssh: connect to host" { send_user " FAILED: Invalid Host\n" ; exit -1 }
-re "authenticity" { send "yes\n"
expect {
-re "word: " { send "$PASSWORD\n" } abort
}
}
-re "word: " { send "$PASSWORD\n" } abort
}
expect {
-re "# " exit
-re "Permission denied" { send_user " FAILED: Invalid password\n" ; exit 1 }
-re "(y or n)" { send "y\n"
expect -re "# " { exit 0 }
}
}
exit 0