1,新建脚本文件
touch /export/Shell/auto-del-log.sh
2,修改脚本文件权限
chmod +x /export/Shell/auto-del-log.sh
3,脚本文件执行内容
#!/bin/sh
find /export/Instances/pplanT.jd.local/server1/logs -name "$(date "+%Y").*" -exec rm -rf {} \;
#!/bin/sh
find /export/Instances/pplanT.jd.local/server1/logs/* -type d -exec rm -rf {} \;
4,定时执行
crontab -e
*/1 * * * * sh /export/Shell/auto-del-log.sh once > /dev/null 2>&1 &
crontab -l
重载定时配置:service crond reload
重启定时服务:service crond restart