mydumper自動化安裝指令碼

longer3281發表於2018-06-21
#!/usr/bin/expect -f

set hname [lindex $argv 0]
set timeout 1

spawn ssh -p 22000 lilongqian@$hname
expect {
"yes/no" {send "yes\r" }
"password" {send "test\r"; }
}
expect "$"
send "sudo yum install -y pcre* glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel\r"
send "mkdir -p /home/myhomedir/soft/tools\r"
send "exit\r"
interact eof


spawn scp -P22000 /home/myhomedir/upload/mydumper/mydumper-0.9.1.tar.gz lilongqian@$hname:/home/myhomedir/soft/tools
expect {
"yes/no" {send "yes\r" }
"password" {send "ok\r"; }
}
interact eof


spawn ssh -p 22000 lilongqian@$hname
expect {
"yes/no" {send "yes\r" }
"password" {send "ok\r"; }
}
expect "$"
send "tar -zxvf /home/myhomedir/tools/mydumper-0.9.1.tar.gz -C/home/myhomedir/tools\r"
send "cd /home/myhomedir/tools/mydumper-0.9.1\r"
send "cmake .\r"
send "make \r"
send "sudo make install\r"
send "exit\r"
interact eof

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9606353/viewspace-2156460/,如需轉載,請註明出處,否則將追究法律責任。

相關文章