码迷,mamicode.com
首页 > 数据库 > 详细

远程清除数据库的脚本

时间:2015-03-31 20:04:42      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/local/bin/expect -f

set timeout -1

set UFEIpAddr “”
set User “”
set UFEPwd ""
set UFEDBPwd ""

set SMNIpAddr ""
set SMNPwd ""
set SMNDBPwd ""

spawn ssh $User@$UFEIpAddr
expect  {
        "yes/no" { send "yes\n"; expect "*assword:" { send "$UFEPwd\n" } }
        "*assword:" { send "$UFEPwd\n"; }
}
expect "]#"
send "mysql -uroot -p$UFEDBPwd -e ‘delete from cc.search_records; delete from cc.tasks;delete from tt.fileinfo; delete from tt.taskinfo;‘\r"
expect "]#"
send \003

spawn ssh $User@$SMNIpAddr
expect  {
        "yes/no" { send "yes\n"; expect "*assword:" { send "$SMNPwd\n" } }
        "*assword:" { send "$SMNPwd\n"; }
}
expect "]#"
send "mysql -uroot -p$SMNDBPwd -e ‘delete from scc.taskrecord; delete from scc.localvideorecord; delete from scc.videorecord;‘\r echo ‘DELED‘\r"
expect "]#"
send \003

远程清除数据库的脚本

标签:

原文地址:http://www.cnblogs.com/dorothychai/p/4381773.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!