远程清除数据库的脚本
#!/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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。