079-一个简单的定时计划任务

1. 用户需求:10.0.2.178与10.0.2.187 这两台服务器
/app/onesearch/logs 目录可只保留5天的日志,default.log 默认要保留文件
/app/AsposeConverter_HTML/Linux/logs  目录可只保留5天的日志,默认要保留converter.log文件 
2.操作过程
cat /home/vkapp/start.sh 
#/bin/bash
#create by xiongchao at 20180305
cd /app/onesearch/logs/
find /app/onesearch/logs/ -type f -mtime  +4 -iname "default.log-*"  -exec rm -f {} \;
cd  /app/AsposeConverter_HTML/Linux/logs/
find /app/AsposeConverter_HTML/Linux/logs/ -type f -mtime  +4 -iname "converter.log.*"    -exec rm -f {} \;

计划任务脚本:

chmod +x   /home/vkapp/start.sh
 * * */3 * *  /bin/sh  /home/vkapp/start.sh    >&  /dev/null

猜你喜欢

转载自my.oschina.net/u/3635512/blog/1629980