linux 增加定时任务 删除日志

rmCharlog.sh

#!/bin/bash
echo `date +%Y-%m-%d` >> /l/rmCharlog.log
find /usr/app/glassfish/domains/domain1/logs -mtime +2 >> /l/rmCharlog.log
find /usr/app/glassfish/domains/domain1/logs -mtime +2 -exec rm -rf {} \;
echo "###############################################################################" >> /lrmCharlog.log


crontab -e
30 1 * * * /l/rmCharlog.sh

猜你喜欢

转载自zhang80jie.iteye.com/blog/1847424