首页 > 数据库技术 > 详细

远程清除数据库的脚本

时间:2015-03-31 20:02:52      阅读:283      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!