vim filterData.sh
result_time=`date -d "today" +"%Y%m%d"`
result_file=/home/gree/msa/yw_msa/sheeldLogic/log/${result_time}_result_sheeldLogic.log
mysql -h 10.2.5.52 -uname -ppwd -e"use g_details;
delete a.*from t1 a,(select id,pdate from t2 where pdate<\"2018-09-01 00:00:00\" )b where a.ename in (\"name1","name2\")
and a.id=b.id;
delete a.* from t1 a inner join(select id,pdate from t2 )b where a.ename in (\"name1","name2\") and b.pdate<\"2018-09-01 00:00:00\" and a.id=b.id; "
echo "mysql_ok">>${result_file}
`date -d "today" +"%Y-%m-%d %H:%M:%S"`>>${result_file}
# mysql 每天按需求删除数据(每60分钟删除一次)
crontab -e
*/60 * * * * sh /home/ge/msa/yw_msa/mysql_producedate_filter/filterData.sh
#每个整点执行1次
0 */1 * * * sh /home/ge/msa/yw_msa/mysql_producedate_filter/filterData.sh
#每3个整点执行1次
0 */3 * * * sh /home/ge/msa/yw_msa/mysql_producedate_filter/filterData.sh
分 时 天 月 星期
每五分钟执行 */5 * * * *
每小时执行 0 * * * *
每天执行 0 0 * * *
每周执行 0 0 * * 0
每月执行 0 0 1 * *
每年执行 0 0 1 1 *