1 目的
为了实现自动清理数据库鉴权日志
2方法
1 )写脚本
[[email protected] mysql]# more qingli_t_auth_log.sh
#!/usr/bin/expect
set timeout 1000
spawn mysql -uroot -ppasswd
expect "mysql>"
send "use db4vasplatform;\n"
expect "mysql>"
send "truncate table t_auth_log;\n"
expect "mysql>"
send "exit\n"
interact
2 )定时执行
[[email protected] mysql]# crontab -l
20 15 * * 2 /var/lib/mysql/qingli_t_auth_log.sh >/dev/null 2>&1
时间: 2024-12-19 00:13:11